use clap::Subcommand;
use super::{
BadgeArgs, BaselineArgs, CliAnalyzeArgs, CliCheckIgnoreArgs, CliContextArgs, CliExportArgs,
CliGateArgs, CliLangArgs, CliModuleArgs, CockpitArgs, CompletionsArgs, DiffArgs,
EvidencePacketArgs, HandoffArgs, InitArgs, RunArgs, SensorArgs, ToolsArgs,
};
#[cfg(feature = "ast")]
use super::SyntaxArgs;
#[derive(Subcommand, Debug, Clone)]
pub enum Commands {
Lang(CliLangArgs),
Module(CliModuleArgs),
Export(CliExportArgs),
#[command(visible_alias = "analyse")]
Analyze(CliAnalyzeArgs),
Badge(BadgeArgs),
Init(InitArgs),
#[command(visible_alias = "completion")]
Completions(CompletionsArgs),
Run(RunArgs),
Diff(DiffArgs),
Context(CliContextArgs),
CheckIgnore(CliCheckIgnoreArgs),
Tools(ToolsArgs),
Gate(CliGateArgs),
Cockpit(CockpitArgs),
Baseline(BaselineArgs),
Handoff(HandoffArgs),
Sensor(SensorArgs),
#[cfg(feature = "ast")]
Syntax(SyntaxArgs),
EvidencePacket(EvidencePacketArgs),
}
#[cfg(test)]
mod tests {
use clap::Parser;
use super::*;
use crate::cli::parser::Cli;
#[test]
fn depth_visible_alias_sets_module_depth_for_module_like_commands() {
let cli = Cli::try_parse_from(["tokmd", "module", "--depth", "3"]).unwrap();
match cli.command.unwrap() {
Commands::Module(args) => assert_eq!(args.module_depth, Some(3)),
other => panic!("unexpected command: {other:?}"),
}
let cli = Cli::try_parse_from(["tokmd", "export", "--depth", "3"]).unwrap();
match cli.command.unwrap() {
Commands::Export(args) => assert_eq!(args.module_depth, Some(3)),
other => panic!("unexpected command: {other:?}"),
}
let cli = Cli::try_parse_from(["tokmd", "context", "--depth", "3"]).unwrap();
match cli.command.unwrap() {
Commands::Context(args) => assert_eq!(args.module_depth, Some(3)),
other => panic!("unexpected command: {other:?}"),
}
let cli = Cli::try_parse_from(["tokmd", "handoff", "--depth", "3"]).unwrap();
match cli.command.unwrap() {
Commands::Handoff(args) => assert_eq!(args.module_depth, Some(3)),
other => panic!("unexpected command: {other:?}"),
}
}
}