These are chat archives for kbknapp/clap-rs

16th
Jan 2018
Kevin K.
@kbknapp
Jan 16 2018 14:36
@rrichardson sorry, I missed these messages :worried:
Rick Richardson
@rrichardson
Jan 16 2018 14:51
no worries.. the root cause of this problem was that the default yaml formatter in vim is lousy :P
that part of the code could stand to have better error messages, I reckon.. I should put in a PR
Kevin K.
@kbknapp
Jan 16 2018 15:04
I'm all for it! :)
Jaanus Varus
@discosultan
Jan 16 2018 16:06

Hi all! I have a quick question about template modification.

I would like to use the default help template but slightly modify it. The only modification would be to add a newline before {version} part. Is there a way to access the default template string? I tried looking it up from the source but couldn't find where it is specified/built. There were a bunch of template related literals in tests and benches, but I'd rather access the default one programmatically and modify that.

Kevin K.
@kbknapp
Jan 16 2018 16:19
If that's the only modification you want to make, I'd recommend using adding the newline to the Arg::version method such as app.version("\nv1.1") or similar
There isn't a default template per se because not all help messages have all the sections (subcommands, args, flags, options, etc.).
Here is what the default would look like though (with all sections)
{bin} {version}
{author}
{about}

USAGE:
    {usage}

FLAGS:
{flags}
OPTIONS:
{options}
ARGS:
{positionals}
SUBCOMMANDS:
{subcommands}
Jaanus Varus
@discosultan
Jan 16 2018 17:23
Thanks @kbknapp , that helps a lot!
Kevin K.
@kbknapp
Jan 16 2018 17:24
no problem!