Abbaye

at 6297799

use std::path::PathBuf;

use clap::Parser;
use clap::Subcommand;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct CliArgs {
    /// Verbosity level (0 = normal, 1 = verbose, 2 = debug)
    #[arg(short, long, default_value_t = 0, action=clap::ArgAction::Count)]
    pub verbose: u8,
    #[command(subcommand)]
    pub command: CliCommand,
}

#[derive(Subcommand, Debug, Clone)]
pub enum CliCommand {
    /// Initialize a new abbaye.toml file
    Init {
        /// path to directory to initialize in
        path: Option<PathBuf>,
    },
    /// Build the site
    Build,
    /// Build the site for every git tag, starting from the lowest semver version.
    /// Checks out each tag in order, builds, then restores the original HEAD.
    BuildAll,
    /// Dumps the default theme to `.abbaye/theme` so you can inspect and modify it. It will be used afterwards when building the site.
    DumpTheme,
    /// Print a JSON Schema for `abbaye.toml` to stdout.
    ///
    /// Redirect the output to a file (e.g. `abbaye dump-schema > abbaye.schema.json`) and
    /// point your editor or TOML language server at it to get field descriptions and
    /// auto-completion while editing `abbaye.toml`.
    DumpSchema,
    /// Check for a newer version of abbaye and update the binary if one is available.
    SelfUpdate {
        /// Only check whether an update is available; do not download or replace the binary.
        #[arg(short, long)]
        check: bool,
    },
    /// Print a usage spec (https://usage.jdx.dev) to stdout.
    ///
    /// Pipe the output to the `usage` CLI to generate shell completions, man pages, or docs:
    ///   `abbaye usage-spec | usage generate completion bash`
    ///   `abbaye usage-spec | usage generate manpage --out-file abbaye.1`
    #[command(hide = true)]
    UsageSpec,
}