diff --git a/docs/examples/complex-app.md b/docs/examples/complex-app.md
index 0c9aad8..a357309 100644
--- a/docs/examples/complex-app.md
+++ b/docs/examples/complex-app.md
@@ -6,6 +6,7 @@ This document contains the help content for the `complex-app` command-line progr
* [`complex-app`↴](#complex-app)
* [`complex-app test`↴](#complex-app-test)
+* [`complex-app only-hidden-options`↴](#complex-app-only-hidden-options)
## `complex-app`
@@ -16,6 +17,7 @@ An example command-line tool
###### **Subcommands:**
* `test` — does testing things
+* `only-hidden-options` — Demo that `Options` is not printed if all options are hidden
###### **Arguments:**
@@ -49,6 +51,14 @@ does testing things
+## `complex-app only-hidden-options`
+
+Demo that `Options` is not printed if all options are hidden
+
+**Usage:** `complex-app only-hidden-options`
+
+
+
diff --git a/docs/examples/complex_app.rs b/docs/examples/complex_app.rs
index ca7e437..021be97 100644
--- a/docs/examples/complex_app.rs
+++ b/docs/examples/complex_app.rs
@@ -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,
}
@@ -32,6 +35,11 @@ enum Commands {
#[arg(short, long)]
list: bool,
},
+ /// Demo that `Options` is not printed if all options are hidden
+ OnlyHiddenOptions {
+ #[arg(short, long, hide = true)]
+ secret: bool,
+ },
}
#[derive(clap::ValueEnum)]
diff --git a/src/lib.rs b/src/lib.rs
index 489eaba..2f01c2c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -304,7 +304,7 @@ fn build_command_markdown(
let non_pos: Vec<_> = command
.get_arguments()
- .filter(|arg| !arg.is_positional())
+ .filter(|arg| !arg.is_positional() && !arg.is_hide_set())
.collect();
if !non_pos.is_empty() {