From 8e14136fc4d64070c38780c31453d6dfa8f88cc4 Mon Sep 17 00:00:00 2001 From: JoseVelazcoH Date: Mon, 6 Jul 2026 10:31:59 -0600 Subject: [PATCH] feat(cli): wire --version/-V to the package version --- src/cli.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index c5eaa09..5ccbc1a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -5,6 +5,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, \ @@ -764,3 +765,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")) + ); + } +}