help-probe 0.1.0

CLI tool discovery and automation framework that extracts structured information from command help text
Documentation
use clap::Parser;

/// Top-level CLI options for help-probe.
#[derive(Parser, Debug)]
#[command(
    name = "help-probe",
    version,
    about = "Run a command's help and parse its usage"
)]
pub struct Cli {
    /// The command and its arguments to inspect.
    ///
    /// Example:
    ///   help-probe -- ls --help
    ///   help-probe -- ffmpeg -h
    ///   help-probe -- myprog --usage
    #[arg(trailing_var_arg = true, required = true)]
    pub cmd: Vec<String>,

    /// Timeout in seconds for the target command
    #[arg(long, default_value_t = 3)]
    pub timeout_secs: u64,

    /// Run command even when no help flag is present (no confirmation).
    #[arg(long)]
    pub force: bool,

    /// Show raw stdout/stderr from the command.
    #[arg(long)]
    pub verbose: bool,

    /// Emit JSON instead of human-readable text.
    #[arg(long)]
    pub json: bool,

    /// Generate shell completion script.
    /// Supported shells: bash, zsh, fish, powershell, nushell
    #[arg(long, value_name = "SHELL")]
    pub generate_completion: Option<String>,

    /// Output file for completion/builder/docs generation (prompts if file exists).
    /// If not specified, output is written to stdout.
    #[arg(long, value_name = "FILE")]
    pub output: Option<std::path::PathBuf>,

    /// Validate a command invocation.
    /// Validates the provided command and arguments against the probed command spec.
    #[arg(long)]
    pub validate: bool,

    /// Generate command builder code.
    /// Supported languages: rust, python, javascript, typescript
    #[arg(long, value_name = "LANGUAGE")]
    pub generate_builder: Option<String>,

    /// Recursively discover all subcommands and build complete command tree.
    /// This probes each subcommand to discover nested commands, options, and arguments.
    #[arg(long)]
    pub discover_all: bool,

    /// Maximum depth for recursive discovery (default: 5).
    #[arg(long, default_value_t = 5)]
    pub max_depth: usize,

    /// Generate API documentation.
    /// Supported formats: markdown, html, openapi, jsonschema
    #[arg(long, value_name = "FORMAT")]
    pub generate_api_docs: Option<String>,

    /// Disable caching of probe results.
    #[arg(long)]
    pub no_cache: bool,

    /// Clear cache for the specified command (or all cache if no command provided).
    #[arg(long)]
    pub clear_cache: bool,

    /// Cache directory path (default: ~/.cache/help-probe).
    #[arg(long, value_name = "DIR")]
    pub cache_dir: Option<String>,
}