1use clap::Parser;
2
3use crate::{debug_log::LogLevel, version};
4
5const VERSION_INFO: version::VersionInfo = version::VersionInfo::from_env();
6
7#[derive(Parser)]
8#[command(name = "basalt", version = VERSION_INFO.to_string())]
9pub struct Cli {
10 #[arg(long)]
12 pub debug: bool,
13
14 #[arg(long, value_enum, default_value_t = LogLevel::Trace)]
16 pub log_level: LogLevel,
17
18 #[arg(long)]
20 pub theme: Option<String>,
21}
22
23#[cfg(test)]
24mod tests {
25 use clap::CommandFactory;
26
27 use crate::{cli::Cli, version};
28
29 #[test]
30 fn version_output() {
31 let help = Cli::command()
32 .version(
33 version::VersionInfo {
34 version: "0.12.5",
35 hash: Some("abc123def0123456789"),
36 short_hash: Some("abc123def"),
37 date: Some("2026-05-15"),
38 }
39 .to_string(),
40 )
41 .render_version()
42 .to_string();
43 insta::assert_snapshot!(help)
44 }
45
46 #[test]
47 fn help_output() {
48 let help = Cli::command().render_help().to_string();
49 insta::assert_snapshot!(help)
50 }
51}