Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including Verbosity adds the doc comment to the help output #20

Closed
sd2k opened this issue Jan 3, 2020 · 5 comments · Fixed by #21
Closed

Including Verbosity adds the doc comment to the help output #20

sd2k opened this issue Jan 3, 2020 · 5 comments · Fixed by #21

Comments

@sd2k
Copy link

sd2k commented Jan 3, 2020

The simple example in the crate docs demonstrates the behaviour:

use structopt::StructOpt;
use clap_verbosity_flag::Verbosity;

#[derive(Debug, StructOpt)]
struct Cli {
    #[structopt(flatten)]
    verbose: Verbosity,
}

fn main() {
    Cli::from_args();
}

Then running:

❯ ./target/debug/examples/simple --help
clap-verbosity-flag 0.3.0
Easily add a `--verbose` flag to CLIs using Structopt

# Examples

```rust use structopt::StructOpt; use clap_verbosity_flag::Verbosity;

/// Le CLI #[derive(Debug, StructOpt)] struct Cli { #[structopt(flatten)] verbose: Verbosity, } # # fn main() {} ```

USAGE:
    simple [FLAGS]

FLAGS:
    -h, --help
            Prints help information

    -q, --quiet
            Pass many times for less log output

    -V, --version
            Prints version information

    -v, --verbose
            Pass many times for more log output

            By default, it'll only report errors. Passing `-v` one time also prints warnings, `-vv` enables info
            logging, `-vvv` debug, and `-vvvv` trace.

Is this perhaps due to a new version of structopt?

@sd2k
Copy link
Author

sd2k commented Jan 3, 2020

I just checked and it looks like this change occurred between structopt versions 0.3.5 and 0.3.7 (0.3.6 has been yanked).

@sd2k sd2k changed the title Including Verbosity adds the docstring to the help output Including Verbosity adds the doc comment to the help output Jan 3, 2020
@jhg
Copy link

jhg commented Jan 16, 2020

Same error. Even using a doc comment in the struct it use clap_verbosity-flag doc comment yet.

epage pushed a commit to epage/clap-verbosity-flag that referenced this issue Jan 16, 2020
strcutopt lets you define the help string via doc-comments.  Recently,
they cleaned this up which introduced a bug where a chained struct wins
out over the parent.

So moving our doc-comment to the lib to workaround it.  We should have
the majority of the documentation on the lib anyways.

Fixed clap-rs#20
@epage
Copy link
Member

epage commented Jan 16, 2020

This looks like a bug in structopt. I've created and issue over there (TeXitoi/structopt#333) and am working on a workaround for clap-verbosity-flag until then.

@epage epage closed this as completed in #21 Jan 16, 2020
@epage
Copy link
Member

epage commented Jan 16, 2020

v0.3.1 should now be released.

@jhg
Copy link

jhg commented Jan 30, 2020

Thanks @epage, it's working now! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants