airs_memspec/cli/
mod.rs

1// CLI module for airs-memspec
2// Handles command-line interface, argument parsing, and command dispatch
3
4use clap::Parser;
5
6pub mod args;
7pub mod commands;
8
9pub use args::{Cli, Commands, GlobalArgs, TaskAction};
10
11/// Main CLI entry point
12pub fn run() -> Result<(), Box<dyn std::error::Error>> {
13    let cli = Cli::parse();
14
15    // Set up logging based on global args
16    setup_logging(&cli.global)?;
17
18    // Dispatch to appropriate command handler
19    match cli.command {
20        Commands::Install {
21            target,
22            force,
23            template,
24        } => commands::install::run(&cli.global, target, force, template),
25        Commands::Status {
26            detailed,
27            project,
28        } => commands::status::run(&cli.global, detailed, project),
29        Commands::Context { workspace, project } => {
30            commands::context::run(&cli.global, workspace, project)
31        }
32        Commands::Tasks { action } => commands::tasks::run(&cli.global, action),
33    }
34}
35
36/// Set up logging and output formatting based on global arguments
37fn setup_logging(global: &GlobalArgs) -> Result<(), Box<dyn std::error::Error>> {
38    // Configure colored output
39    if global.no_color {
40        colored::control::set_override(false);
41    }
42
43    // TODO: Set up proper logging based on verbose/quiet flags
44    // For now, just store the configuration
45
46    Ok(())
47}