Skip to main content

generate

Function generate 

Source
pub fn generate(
    cmd: &'_ mut Command,
    config: Config,
    w: &mut impl Write,
) -> Result<(), GenerateError>
Expand description

Generate the scaffold for your completion based on clap::Command object. After importing the generated code, you can call CMD.supplement(args) to get the completion result.


use supplement::generate;
let config = Default::default();
let mut cmd = clap::Command::new("git");

// Print the generated code to stdout
generate(&mut cmd, config, &mut std::io::stdout()).unwrap();

full example can be found in supplement-example/src/main.rs