diff --git a/crates/rite-cli/src/main.rs b/crates/rite-cli/src/main.rs index e86301b..58b2439 100644 --- a/crates/rite-cli/src/main.rs +++ b/crates/rite-cli/src/main.rs @@ -12,6 +12,7 @@ use clap_complete::{Shell, generate}; #[derive(Parser)] #[command(name = "rite")] +#[command(version)] #[command(about = "A CLI for cryptographic key ceremonies", long_about = None)] struct Cli { #[command(subcommand)] @@ -46,3 +47,17 @@ fn main() { } } } + +#[cfg(test)] +mod tests { + use super::*; + use clap::error::ErrorKind; + + #[test] + fn supports_top_level_version_flag() { + match Cli::try_parse_from(["rite", "--version"]) { + Ok(_) => panic!("--version should exit"), + Err(err) => assert_eq!(err.kind(), ErrorKind::DisplayVersion), + } + } +}