Files
husk-milter/src/commands.rs
T
Malte Meiboom 6611a43a24 Add subcommand to list local certificates
- Add `husk locals list` to list all certificates which would be used by
  husk, but are not introduced by another certificate. These
  certificates are added 'locally'.
- Refcator the code so that `local` -> `locals`.
2026-05-15 12:59:24 +02:00

41 lines
1.1 KiB
Rust

use anyhow::Result;
use sequoia_openpgp::Fingerprint;
use crate::commands;
use crate::cli::cli_args::{CliArgs, HuskSubcommands};
use crate::config::HuskConfigContainer;
pub mod daemon;
pub mod introducer;
pub mod locals;
#[derive(thiserror::Error, Debug)]
pub enum CommandError {
#[error("Certificate not found: {0}")]
CertNotFound(Fingerprint),
#[error("Certificate not usable: {0}")]
CertNotUsable(Fingerprint),
#[error("Certificate {0} is not alive (is expired or created in the future)")]
CertNotAlive(Fingerprint),
#[error("Certificate is revoked: {0}")]
CertRevoked(Fingerprint),
}
pub async fn dispatch(cli: CliArgs, config: HuskConfigContainer) -> Result<()> {
match cli.subcommand {
HuskSubcommands::Daemon(subcmd) => {
commands::daemon::dispatch(subcmd, config).await?;
},
HuskSubcommands::Introducer(subcmd) => {
commands::introducer::dispatch(subcmd, config).await?;
},
HuskSubcommands::Locals(subcmd) => {
commands::locals::dispatch(subcmd, config).await?;
},
}
Ok(())
}