Complete skeleton dispatcher

- Complete the dispatcher for the 'introducer' and 'local' command. This
  is currently only a skeleton.
- The 'introducer list' command is added.
This commit is contained in:
Malte Meiboom
2026-04-27 13:17:03 +02:00
parent c33feb1ee7
commit 799f6eb588
11 changed files with 183 additions and 13 deletions
+34
View File
@@ -0,0 +1,34 @@
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(())
}