Skip to content

Commit

Permalink
Do not show hidden arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Jun 13, 2024
1 parent d3985a3 commit 8ef59d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/examples/complex_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub struct Cli {
#[arg(short, long, action = clap::ArgAction::Count)]
debug: u8,

#[arg(short, long, hide = true)]
secret_arg: bool,

#[command(subcommand)]
command: Option<Commands>,
}
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ fn build_command_markdown(
}

fn write_arg_markdown(buffer: &mut String, arg: &clap::Arg) -> fmt::Result {
// Don't print docs for hidden args
if arg.is_hide_set() {
return Ok(());
}
// Markdown list item
write!(buffer, "* ")?;

Expand Down

0 comments on commit 8ef59d9

Please sign in to comment.