Skip to content

Commit

Permalink
Enable ColoredHelp for mask and all subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSensor committed Sep 11, 2019
1 parent b704f63 commit efc2b6d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
35 changes: 35 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ name = "mask"
path = "src/lib.rs"

[dependencies]
clap = "2.33.0" # https://github.com/clap-rs/clap
colored = "1.8.0" # https://github.com/mackwic/colored
pulldown-cmark = { version = "0.5", default-features = false } # https://github.com/raphlinus/pulldown-cmark

[dependencies.clap] # https://github.com/clap-rs/clap
version = "2.33.0"
features = ["wrap_help", "color"]

[dev-dependencies]
assert_cmd = "0.11.1" # https://github.com/assert-rs/assert_cmd
assert_fs = "0.11.3" # https://github.com/assert-rs/assert_fs
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fn main() {
let cli_app = App::new(crate_name!())
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::ColoredHelp)
.version(crate_version!())
.author(crate_authors!())
.about(crate_description!())
Expand Down Expand Up @@ -89,7 +90,7 @@ fn build_subcommands<'a, 'b>(
subcommands: &'a Vec<Command>,
) -> App<'a, 'b> {
for c in subcommands {
let mut subcmd = SubCommand::with_name(&c.name).about(c.desc.as_ref());
let mut subcmd = SubCommand::with_name(&c.name).about(c.desc.as_ref()).setting(AppSettings::ColoredHelp);
if !c.subcommands.is_empty() {
subcmd = build_subcommands(subcmd, &c.subcommands);
// If this parent command has no script source, require a subcommand.
Expand Down

0 comments on commit efc2b6d

Please sign in to comment.