#[structopt(raw(setting = "structopt::clap::AppSettings::ColorAuto"))]
#[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))]
It seems I have to copy&paste it before every single sub-command to get colored help everywhere as per "NOTE: When these settings are used, they apply only to current command, and are not propagated down or up through child or parent subcommands" https://docs.rs/structopt/0.2.18/structopt/clap/enum.ArgSettings.html
Is there any shortcut?
Sorry no, a bit related to #172
@dpc Well, in structopt 0.3 you'll be able to do something like this
use structopt::clap::AppSettings::*;
#[structopt(setting(ColorAuto), setting(ColoredHelp))]
which is a way shorter than it used to be. You're still going to have to copy-paste in on every subcommand, I don't think we can do much about it in structopt.
That's the thing - copy-pasting it over 100 subcommands I have is not awesome. I don't even understand why would anyone want colors in some subcommands but not the others. :D
That's inherited from clap: you have to do that with clap. This issue is open to discuse a solution and someone can then simplement it. PR welcome.
@dpc will clap::App::global_setting(ColoredHelp) do the trick? If so, you can use it with structopt 0.3 via
#[structopt(global_setting(ColoredHelp))]
or
#[structopt(raw(global_setting = "structopt::clap::AppSettings::ColoredHelp"))]
in structopt 0.2
I will try that!
@CreepySkeleton I don't thin 0.3 is release yet, BTW, but 0.2 version works like a charm.
@dpc Yeah, 0.3 is upcoming, I hope we'll manage to release it by the end of month, it'll make a lot of things easier. Just so you know: clap has a very rich API, and you can use any method from App and Arg via #[structopt(raw(method = "args"))] in 0.2 or directly in 0.3, like this #[structopt(method(args))].
P.S I wonder what a program with over a hundred subcommands could possibly be?
I exaggerated, but in cargo-crev keeps growing in subcomands, because everything is <verb> <noun> [<qualifier>].
Most helpful comment
@dpc will
clap::App::global_setting(ColoredHelp)do the trick? If so, you can use it withstructopt 0.3via#[structopt(global_setting(ColoredHelp))]or
#[structopt(raw(global_setting = "structopt::clap::AppSettings::ColoredHelp"))]in
structopt 0.2