Skip to content
Discussion options

You must be logged in to vote

Self-correction after re-reading the source. I went back to verify the symbol names I used and my code snippet is wrong on one detail — there's no tokei::cli::build_cli(). src/cli.rs builds the clap Command inline inside Cli::from_args() and discards it after parsing into ArgMatches, so it's not exposed publicly.

The actual implementation needs a small refactor first: extract the Command builder into a pub fn cli_command() -> clap::Command in src/cli.rs, call it from Cli::from_args(), and call it again from the new completion flag. Concrete shape:

// src/cli.rs
pub fn cli_command() -> clap::Command {
    clap::Command::new("tokei")
        .version(crate_version())
        .author("Erin P…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Freed-Wu
Comment options

Answer selected by Freed-Wu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants