-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implemented more cli help for args/flags/subcommands
- Loading branch information
Showing
12 changed files
with
315 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{%- if spec.about_long %}{{ spec.about_long }} | ||
|
||
{% elif spec.about %}{{ spec.about }} | ||
|
||
{% endif %} | ||
Usage: {{ spec.bin ~ " " ~ cmd.usage | trim }} | ||
|
||
{%- if cmd.subcommands %} | ||
|
||
Commands: | ||
{%- for name, cmd in cmd.subcommands %} | ||
{{ cmd.usage | trim }} | ||
{%- if cmd.aliases %} [aliases: {{ cmd.aliases | join(sep=", ") }}]{% endif %} | ||
{%- set help = cmd.help_long | default(value=cmd.help) %} | ||
{%- if help %} | ||
{{ help | indent(width=4) }} | ||
{%- endif %} | ||
{% endfor %} | ||
help | ||
Print this message or the help of the given subcommand(s) | ||
{%- endif %} | ||
|
||
{%- if cmd.args %} | ||
|
||
Arguments: | ||
{%- for arg in cmd.args %} | ||
{{ arg.usage | trim }} | ||
{%- set help = arg.help_long | default(value=arg.help) %} | ||
{%- if help %} | ||
{{ help | indent(width=2) }} | ||
{%- endif %} | ||
{%- if arg.choices %} | ||
[possible values: {{ arg.choices.choices | join(sep=", ") }}] | ||
{%- endif %} | ||
{%- endfor %} | ||
{%- endif %} | ||
|
||
{%- if cmd.flags %} | ||
|
||
Flags: | ||
{%- for flag in cmd.flags %} | ||
{{ flag.usage | trim }} | ||
{%- if flag.aliases %} [aliases: {{ flag.aliases | join(sep=", ") }}]{% endif %} | ||
{%- set help = flag.help_long | default(value=flag.help) %} | ||
{%- if help %} | ||
{{ help | indent(width=2) }} | ||
{%- endif %} | ||
{%- if flag.arg.choices %} | ||
[possible values: {{ flag.arg.choices.choices | join(sep=", ") }}] | ||
{%- endif %} | ||
{%- endfor %} | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{% if spec.about %}{{ spec.about }} | ||
|
||
{% endif %} | ||
Usage: {{ spec.bin ~ " " ~ cmd.usage | trim }} | ||
|
||
{%- if cmd.subcommands %} | ||
|
||
Commands: | ||
{%- for name, cmd in cmd.subcommands %} | ||
{{ cmd.usage | trim }} | ||
{%- if cmd.aliases %} [aliases: {{ cmd.aliases | join(sep=", ") }}]{% endif %} | ||
{%- if cmd.help %} {{ cmd.help }}{%- endif %} | ||
{%- endfor %} | ||
help Print this message or the help of the given subcommand(s) | ||
{%- endif %} | ||
|
||
{%- if cmd.args %} | ||
|
||
Arguments: | ||
{%- for arg in cmd.args %} | ||
{{ arg.usage | trim }} | ||
{%- if arg.help %} {{ arg.help }}{%- endif %} | ||
{%- if arg.choices %} [{{ arg.choices.choices | join(sep=", ") }}]{%- endif %} | ||
{%- endfor %} | ||
{%- endif %} | ||
|
||
{%- if cmd.flags %} | ||
|
||
Flags: | ||
{%- for flag in cmd.flags %} | ||
{{ flag.usage | trim }} | ||
{%- if flag.aliases %} [aliases: {{ flag.aliases | join(sep=", ") }}]{% endif %} | ||
{%- if flag.help %} {{ flag.help }}{%- endif %} | ||
{%- if flag.arg.choices %} [{{ flag.arg.choices.choices | join(sep=", ") }}]{%- endif %} | ||
{%- endfor %} | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.