Skip to content

Commit

Permalink
fix: Don't override help strings
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ed Page committed Jan 16, 2020
1 parent c75ce35 commit 0b97928
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
13 changes: 13 additions & 0 deletions examples/example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use clap_verbosity_flag::Verbosity;
use structopt::StructOpt;

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

fn main() {
Cli::from_args();
}
35 changes: 18 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
//! 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() {}
//! ```
use log::Level;

/// 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() {}
/// ```
#[derive(structopt::StructOpt, Debug, Clone)]
pub struct Verbosity {
/// Pass many times for more log output
Expand Down

0 comments on commit 0b97928

Please sign in to comment.