pitchfork-cli 2.21.0

Daemons with DX
Documentation
use crate::Result;
use crate::cli::Cli;
use clap::CommandFactory;

/// Generates a usage spec for the CLI
///
/// https://usage.jdx.dev
#[derive(Debug, clap::Args)]
#[clap(hide = true, verbatim_doc_comment)]
pub struct Usage {}

impl Usage {
    pub async fn run(&self) -> Result<()> {
        let mut cmd = Cli::command();
        let mut spec = clap_usage::spec(&mut cmd, "pitchfork");
        // Declare what each command does to the world; clap cannot express it.
        super::command_effects::apply(&mut spec);
        // 4.0 added flag-level `effect=`; older `usage` CLIs reject the spec with
        // "unsupported cmd prop effect".
        println!("// @generated by usage-cli from clap metadata");
        println!("min_usage_version \"4.0\"");
        println!("{spec}");
        println!("{}", include_str!("../../pitchfork-extras.usage.kdl"));
        Ok(())
    }
}