flop_cli/
cli.rs

1use clap::{Parser, Subcommand};
2use std::path::PathBuf;
3
4#[derive(Parser)]
5#[command(name = "flop")]
6#[command(about = "Interactively flip debug output statements")]
7#[command(long_about = "\
8Interactively flip debug output statements
9
10EXAMPLES:
11    flop on                       Disable all output (interactive)
12    flop on -d                    Disable debug output only (interactive)
13    flop on -y                    Disable all output (batch, with confirmation)
14    flop on -dy                   Disable debug output only (batch)
15    flop off -p                   Preview what would be enabled
16    flop delete -d src/           Delete debug statements in src/ (interactive)
17
18COMMON OPTIONS:
19    -d, --debug    Only process output statements containing 'debug' keyword
20    -y, --yes      Skip interactive selection (batch mode, confirmation still required)
21    -p, --preview  Preview mode - show what would be changed without modifying files
22")]
23pub struct Cli {
24    #[command(subcommand)]
25    pub command: Commands,
26}
27
28#[derive(Subcommand)]
29pub enum Commands {
30    /// Uncomment output statements (enable output)
31    Off {
32        /// Path to file or directory (defaults to current directory)
33        path: Option<PathBuf>,
34        /// Only process output statements containing 'debug' keyword
35        #[arg(short, long)]
36        debug: bool,
37        /// Skip interactive selection (batch mode, confirmation still required)
38        #[arg(short, long)]
39        yes: bool,
40        /// Preview mode - show what would be changed without modifying files
41        #[arg(short, long)]
42        preview: bool,
43    },
44    /// Comment out output statements (disable output)
45    On {
46        /// Path to file or directory (defaults to current directory)
47        path: Option<PathBuf>,
48        /// Only process output statements containing 'debug' keyword
49        #[arg(short, long)]
50        debug: bool,
51        /// Skip interactive selection (batch mode, confirmation still required)
52        #[arg(short, long)]
53        yes: bool,
54        /// Preview mode - show what would be changed without modifying files
55        #[arg(short, long)]
56        preview: bool,
57    },
58    /// Delete output statements
59    Delete {
60        /// Path to file or directory (defaults to current directory)
61        path: Option<PathBuf>,
62        /// Only process output statements containing 'debug' keyword
63        #[arg(short, long)]
64        debug: bool,
65        /// Skip interactive selection (batch mode, confirmation still required)
66        #[arg(short, long)]
67        yes: bool,
68        /// Preview mode - show what would be changed without modifying files
69        #[arg(short, long)]
70        preview: bool,
71    },
72}