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
19#[cfg(test)]
20mod tests {
21 use clap::CommandFactory;
22
23 use crate::{cli::Cli, version};
24
25 #[test]
26 fn version_output() {
27 let help = Cli::command()
28 .version(
29 version::VersionInfo {
30 version: "0.12.5",
31 hash: Some("abc123def0123456789"),
32 short_hash: Some("abc123def"),
33 date: Some("2026-05-15"),
34 }
35 .to_string(),
36 )
37 .render_version()
38 .to_string();
39 insta::assert_snapshot!(help)
40 }
41
42 #[test]
43 fn help_output() {
44 let help = Cli::command().render_help().to_string();
45 insta::assert_snapshot!(help)
46 }
47}