Repository: clap-rs/clap (language: rust)

Issue:
Generated man pages claim that flag options take values
### Please complete the following tasks

- [X] I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
- [X] I have searched the [open](https://github.com/clap-rs/clap/issues) and [rejected](https://github.com/clap-rs/clap/issues?q=is%3Aissue+label%3AS-wont-fix+is%3Aclosed) issues

### Rust Version

rustc 1.64.0 (Fedora 1.64.0-1.fc36)

### Clap Version

4.0.17, clap_mangen 0.2.3

### Minimal reproducible code

```rust
use clap::{CommandFactory, Parser};

#[derive(Parser)]
/// Command to do things
pub struct Cmd {
    /// Do thing
    #[clap(long)]
    thing: bool,
}

fn main() {
    Cmd::parse();
    clap_mangen::Man::new(Cmd::command())
        .render(&mut std::io::stdout())
        .unwrap();
}
```

Cargo.toml:

```toml
[package]
name = "clap-man"
version = "0.0.0"
edition = "2021"

[dependencies]
clap = { version = "4", features = ["derive"] }
clap_mangen = "0.2"
```

### Steps to reproduce the bug with the above code

```
cargo run | man -l -
```

### Actual Behaviour

The option description for `--thing` claims that it takes an argument and that that argument defaults to false:

```
clap-man(1)                 General Commands Manual                clap-man(1)

NAME
       clap-man - Command to do things

SYNOPSIS
       clap-man [--thing] [-h|--help]

DESCRIPTION
       Command to do things

OPTIONS
       --thing=THING [default: false]
              Do thing

       -h, --help
              Print help information

                                   clap-man                        clap-man(1)
```

Of course, it doesn't:

```console
$ cargo run -- --thing=true
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/clap-man --thing=true`
error: The value 'true' was provided to '--thing' but it wasn't expecting any more values

Usage: clap-man --thing

For more information try '--help'
```

### Expected Behaviour

The man page lists the option without any argument, as it did in clap 3.2 / clap_mangen 0.1:

```
clap-man(1)                 General Commands Manual                clap-man(1)

NAME
       clap-man - Command to do things

SYNOPSIS
       clap-man [--thing] [-h|--help]

DESCRIPTION
       Command to do things

OPTIONS
       --thing
              Do thing

       -h, --help
              Print help information

                                   clap-man                        clap-man(1)
```

### Additional Context

_No response_

### Debug Output

_No response_


Discussion / hints:

Fix patch:
diff --git a/clap_mangen/src/render.rs b/clap_mangen/src/render.rs
index e4b09f567b5..08da00e73bd 100644
--- a/clap_mangen/src/render.rs
+++ b/clap_mangen/src/render.rs
@@ -1,3 +1,4 @@
+use clap::ArgAction;
 use roff::{bold, italic, roman, Inline, Roff};
 
 pub(crate) fn subcommand_heading(cmd: &clap::Command) -> &str {
@@ -39,22 +40,24 @@ pub(crate) fn synopsis(roff: &mut Roff, cmd: &clap::Command) {
                 line.push(roman("|"));
                 line.push(bold(&format!("--{}", long)));
                 line.push(roman(rhs));
-                line.push(roman(" "));
             }
             (Some(short), None) => {
                 line.push(roman(lhs));
                 line.push(bold(&format!("-{} ", short)));
                 line.push(roman(rhs));
-                line.push(roman(" "));
             }
             (None, Some(long)) => {
                 line.push(roman(lhs));
                 line.push(bold(&format!("--{}", long)));
                 line.push(roman(rhs));
-                line.push(roman(" "));
             }
-            (None, None) => (),
+            (None, None) => continue,
         };
+
+        if matches!(opt.get_action(), ArgAction::Count) {
+            line.push(roman("..."))
+        }
+        line.push(roman(" "));
     }
 
     for arg in cmd.get_positionals() {
@@ -306,7 +309,7 @@ fn option_environment(opt: &clap::Arg) -> Option<Vec<Inline>> {
 }
 
 fn option_default_values(opt: &clap::Arg) -> Option<String> {
-    if opt.is_hide_default_value_set() {
+    if opt.is_hide_default_value_set() || !opt.get_action().takes_values() {
         return None;
     } else if !opt.get_default_values().is_empty() {
         let values = opt


Test patch:
diff --git a/clap_mangen/tests/snapshots/aliases.bash.roff b/clap_mangen/tests/snapshots/aliases.bash.roff
index 959dfaa3edd..4cd893f1f25 100644
--- a/clap_mangen/tests/snapshots/aliases.bash.roff
+++ b/clap_mangen/tests/snapshots/aliases.bash.roff
@@ -9,7 +9,7 @@ my/-app /- testing bash completions
 testing bash completions
 .SH OPTIONS
 .TP
-/fB/-f/fR, /fB/-/-flag/fR [default: false]
+/fB/-f/fR, /fB/-/-flag/fR
 cmd flag
 .TP
 /fB/-o/fR, /fB/-/-option/fR
diff --git a/clap_mangen/tests/snapshots/basic.bash.roff b/clap_mangen/tests/snapshots/basic.bash.roff
index b0e0f5b14ea..e502cd97a99 100644
--- a/clap_mangen/tests/snapshots/basic.bash.roff
+++ b/clap_mangen/tests/snapshots/basic.bash.roff
@@ -8,10 +8,10 @@ my/-app
 .SH DESCRIPTION
 .SH OPTIONS
 .TP
-/fB/-c/fR [default: false]
+/fB/-c/fR
 
 .TP
-/fB/-v/fR [default: false]
+/fB/-v/fR
 
 .TP
 /fB/-h/fR, /fB/-/-help/fR
diff --git a/clap_mangen/tests/snapshots/feature_sample.bash.roff b/clap_mangen/tests/snapshots/feature_sample.bash.roff
index ad89abedc84..f3cc3bf6125 100644
--- a/clap_mangen/tests/snapshots/feature_sample.bash.roff
+++ b/clap_mangen/tests/snapshots/feature_sample.bash.roff
@@ -4,12 +4,12 @@
 .SH NAME
 my/-app /- Tests completions
 .SH SYNOPSIS
-/fBmy/-app/fR [/fB/-c/fR|/fB/-/-config/fR] [/fB/-h/fR|/fB/-/-help/fR] [/fB/-V/fR|/fB/-/-version/fR] [/fIfile/fR] [/fIchoice/fR] [/fIsubcommands/fR]
+/fBmy/-app/fR [/fB/-c/fR|/fB/-/-config/fR]... [/fB/-h/fR|/fB/-/-help/fR] [/fB/-V/fR|/fB/-/-version/fR] [/fIfile/fR] [/fIchoice/fR] [/fIsubcommands/fR]
 .SH DESCRIPTION
 Tests completions
 .SH OPTIONS
 .TP
-/fB/-c/fR, /fB/-/-config/fR [default: 0]
+/fB/-c/fR, /fB/-/-config/fR
 some config file
 .TP
 /fB/-h/fR, /fB/-/-help/fR
diff --git a/clap_mangen/tests/snapshots/quoting.bash.roff b/clap_mangen/tests/snapshots/quoting.bash.roff
index 7ca1e33241f..60280b4255c 100644
--- a/clap_mangen/tests/snapshots/quoting.bash.roff
+++ b/clap_mangen/tests/snapshots/quoting.bash.roff
@@ -8,22 +8,22 @@ my/-app
 .SH DESCRIPTION
 .SH OPTIONS
 .TP
-/fB/-/-single/-quotes/fR [default: false]
+/fB/-/-single/-quotes/fR
 Can be /*(Aqalways/*(Aq, /*(Aqauto/*(Aq, or /*(Aqnever/*(Aq
 .TP
-/fB/-/-double/-quotes/fR [default: false]
+/fB/-/-double/-quotes/fR
 Can be "always", "auto", or "never"
 .TP
-/fB/-/-backticks/fR [default: false]
+/fB/-/-backticks/fR
 For more information see `echo test`
 .TP
-/fB/-/-backslash/fR [default: false]
+/fB/-/-backslash/fR
 Avoid /*(Aq//n/*(Aq
 .TP
-/fB/-/-brackets/fR [default: false]
+/fB/-/-brackets/fR
 List packages [filter]
 .TP
-/fB/-/-expansions/fR [default: false]
+/fB/-/-expansions/fR
 Execute the shell command with $SHELL
 .TP
 /fB/-h/fR, /fB/-/-help/fR
diff --git a/clap_mangen/tests/snapshots/special_commands.bash.roff b/clap_mangen/tests/snapshots/special_commands.bash.roff
index 0cf113f8cbc..db7b607a49d 100644
--- a/clap_mangen/tests/snapshots/special_commands.bash.roff
+++ b/clap_mangen/tests/snapshots/special_commands.bash.roff
@@ -4,12 +4,12 @@
 .SH NAME
 my/-app /- Tests completions
 .SH SYNOPSIS
-/fBmy/-app/fR [/fB/-c/fR|/fB/-/-config/fR] [/fB/-h/fR|/fB/-/-help/fR] [/fB/-V/fR|/fB/-/-version/fR] [/fIfile/fR] [/fIchoice/fR] [/fIsubcommands/fR]
+/fBmy/-app/fR [/fB/-c/fR|/fB/-/-config/fR]... [/fB/-h/fR|/fB/-/-help/fR] [/fB/-V/fR|/fB/-/-version/fR] [/fIfile/fR] [/fIchoice/fR] [/fIsubcommands/fR]
 .SH DESCRIPTION
 Tests completions
 .SH OPTIONS
 .TP
-/fB/-c/fR, /fB/-/-config/fR [default: 0]
+/fB/-c/fR, /fB/-/-config/fR
 some config file
 .TP
 /fB/-h/fR, /fB/-/-help/fR
diff --git a/clap_mangen/tests/snapshots/sub_subcommands.bash.roff b/clap_mangen/tests/snapshots/sub_subcommands.bash.roff
index f2a22e9de50..9f034036a2c 100644
--- a/clap_mangen/tests/snapshots/sub_subcommands.bash.roff
+++ b/clap_mangen/tests/snapshots/sub_subcommands.bash.roff
@@ -4,12 +4,12 @@
 .SH NAME
 my/-app /- Tests completions
 .SH SYNOPSIS
-/fBmy/-app/fR [/fB/-c/fR|/fB/-/-config/fR] [/fB/-h/fR|/fB/-/-help/fR] [/fB/-V/fR|/fB/-/-version/fR] [/fIfile/fR] [/fIchoice/fR] [/fIsubcommands/fR]
+/fBmy/-app/fR [/fB/-c/fR|/fB/-/-config/fR]... [/fB/-h/fR|/fB/-/-help/fR] [/fB/-V/fR|/fB/-/-version/fR] [/fIfile/fR] [/fIchoice/fR] [/fIsubcommands/fR]
 .SH DESCRIPTION
 Tests completions
 .SH OPTIONS
 .TP
-/fB/-c/fR, /fB/-/-config/fR [default: 0]
+/fB/-c/fR, /fB/-/-config/fR
 some config file
 .TP
 /fB/-h/fR, /fB/-/-help/fR