- Complete the dispatcher for the 'introducer' and 'local' command. This is currently only a skeleton. - The 'introducer list' command is added.
35 lines
974 B
Rust
35 lines
974 B
Rust
use anyhow::Result;
|
|
|
|
use crate::cli::cli_args::{IntroducerCommand, IntroducerSubcommand};
|
|
use crate::config::HuskConfigContainer;
|
|
use crate::types::husk_context::HuskContext;
|
|
use crate::crypto;
|
|
|
|
pub mod add;
|
|
pub mod remove;
|
|
|
|
pub async fn dispatch(cmd: IntroducerCommand, config: HuskConfigContainer) -> Result<()> {
|
|
match cmd.subcommand {
|
|
IntroducerSubcommand::Add(add_cmd) => {
|
|
add::dispatch(add_cmd, &config).await?;
|
|
},
|
|
IntroducerSubcommand::Remove(rm_cmd) => {
|
|
remove::dispatch(rm_cmd, &config).await?;
|
|
},
|
|
IntroducerSubcommand::List => {
|
|
println!("list");
|
|
let context = HuskContext::new(&config.into())?;
|
|
|
|
for introducer in crypto::get_introducers(
|
|
&context.cert_store,
|
|
&context.policy,
|
|
context.local_trust_root.fingerprint()) {
|
|
|
|
println!("{}", introducer);
|
|
}
|
|
},
|
|
}
|
|
|
|
Ok(())
|
|
}
|