diff --git a/src/cli.rs b/src/cli.rs index 5c4faa8..43526b7 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -8,6 +8,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; #[derive(Parser)] #[command( name = "tth", + version, arg_required_else_help = false, about = "Thoth: an intelligent shell history that captures commands with context", long_about = "Thoth records every command you run along with its working directory, \ @@ -842,3 +843,22 @@ fn read_framework_config(framework: &crate::prompt::PromptFramework, home: &str) }; std::fs::read_to_string(config_path).ok() } + +#[cfg(test)] +mod tests { + use super::*; + use clap::CommandFactory; + + #[test] + fn cli_definition_is_valid() { + Cli::command().debug_assert(); + } + + #[test] + fn cli_exposes_package_version() { + assert_eq!( + Cli::command().get_version(), + Some(env!("CARGO_PKG_VERSION")) + ); + } +}