Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions structopt-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@
//! - `author`: Defaults to the crate author name given by Cargo.
//! - `about`: Defaults to the crate description given by Cargo.
//!
//! Methods from `clap::App` that don't take an &str can be called by
//! adding _raw to their name, e.g. to activate colored help text:
//!
//! ```ignore
//! extern crate clap;
//! extern crate structopt;
//! #[macro_use]
//! extern crate structopt_derive;
//!
//! use structopt::StructOpt;
//!
//! #[derive(StructOpt, Debug)]
//! #[structopt(setting_raw = "clap::AppSettings::ColoredHelp")]
//! struct Opt {
//! #[structopt(short = "s")]
//! speed: bool,
//! #[structopt(short = "d")]
//! debug: bool,
//! }
//!
//! fn main() {
//! let opt = Opt::from_args();
//! println!("{:?}", opt);
//! }
//! ```
//!
//! Then, each field of the struct not marked as a subcommand corresponds
//! to a `clap::Arg`. As with the struct attributes, every method of
//! `clap::Arg` in the form of `fn function_name(self, &str)` can be used
Expand Down