-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow styled text in template
#1433
Comments
...and, aesthetics aside, having a |
Equally, if you use, as a guideline, the "full help template" that can be found here: https://github.com/clap-rs/clap/blob/master/tests/example1_tmpl_full.txt ...there is no way to apply the ColoredHelp formatting to the various other headings if, for instance, you wish to change their order or rename them (e.g. for language translations). Unsure at this point of the best approach to getting coloured help output when using custom help templates. |
EDIT: Sorry if you saw the original form of this via e-mail notification. I initially misunderstood the intent of your response. True, but, In my testing, aside from the USAGE: header not being colourized, the template I gave is equivalent to removing the author placeholder from the default template and inserting a newline before
That said, what I'd suggest is some kind of placeholder that resolves to either changing the colour if colourization is enabled or nothing if it's disabled. |
I was thinking along these lines in the context of #1790. Something like
or more generally
And maintain the list of supported colors. I don't want to support any RGB-or-something notations because Windows CMD has only a set of predefined colors and implementing the RGB code => winapi color mapping is something I very much like to avoid. |
template
placeholder for colorized "USAGE:" headertemplate
The original |
My plan is for the API to accept ANSI colored strings. When we output, we use a special stdout/stderr that adapt the ANSI color codes to the capabilities of the terminal. Blocked on https://github.com/epage/anstyle/issues/5 |
Rust Version
rustc 1.32.0 (9fda7c223 2019-01-16)
Affected Version of clap
2.32.0
Bug or Feature Request Summary
When using a custom template to work around papercuts in Clap (#1432) and StructOpt (TeXitoi/structopt#172) which break
help2man
, i can find no documented way to applyAppSettings::ColoredHelp
to the "USAGE:" header, though I've managed to reconstruct the desired bits of all of the rest of the default template.Expected Behavior Summary
I should have some means of reintroducing the conditionally and portably colored
USAGE:
header, like this:NOTE: Image created as a composite of two screenshots.
Actual Behavior Summary
I was able to recreate every desired element of the default template except the coloring on the
USAGE:
header:Steps to Reproduce the issue
AppSettings::ColoredHelp
:Sample Code or Link to Sample Code
https://gist.github.com/ssokolow/9df8c92b24d94116c5eb57fccad2b1a2
The text was updated successfully, but these errors were encountered: