Skip to content

Commit

Permalink
Merge pull request #30 from DrSensor/master
Browse files Browse the repository at this point in the history
Add colored help
  • Loading branch information
jacobdeichert authored Sep 25, 2019
2 parents b7e5e8d + 702afad commit 891eb68
Show file tree
Hide file tree
Showing 3 changed files with 43 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"]

[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
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fn main() {
let cli_app = App::new(crate_name!())
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::ColoredHelp)
.version(crate_version!())
.arg(custom_maskfile_path_arg());

Expand Down Expand Up @@ -84,7 +85,9 @@ 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 891eb68

Please sign in to comment.