-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework help message formatting (#53)
* Rework help message formatting Notable changes: * the default value of options and args are no longer displayed right after the names with an equal sign, e.g. `-f, --force=false`. Instead they are displayed after the description: `(default: 42)` * only the first short name (if set) and the first long name (if set) of options are displayed * do not display the default value for 0-valued options and args, i.e. `0`, `false`, `""` and `[]` * align option long names (by displaying white space if no short name is specified) * align the descriptions of options, arguments and commands * add env word to env vars, e.g. `(env $SUPER_OPTION)` Fixes #52.
- Loading branch information
Showing
9 changed files
with
281 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
testdata/*.golden | ||
coverage.out |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
Usage: app [-bdsuikqs] BOOL1 [STR1] INT3... COMMAND [arg...] | ||
|
||
App Desc | ||
|
||
Arguments: | ||
BOOL1 Bool Argument 1 (env $BOOL1) | ||
BOOL2 Bool Argument 2 (default true) | ||
BOOL3 Bool Argument 3 (env $BOOL3) | ||
STR1 String Argument 1 (env $STR1) | ||
STR2 String Argument 2 (env $STR2) (default "a value") | ||
STR3 String Argument 3 (env $STR3) | ||
INT1 Int Argument 1 (env $INT1) (default 0) | ||
INT2 Int Argument 2 (env $INT2) (default 1) | ||
INT3 Int Argument 3 (env $INT3) | ||
STRS1 Strings Argument 1 (env $STRS1) | ||
STRS2 (env $STRS2) (default ["value1", "value2"]) | ||
STRS3 Strings Argument 3 (env $STRS3) | ||
INTS1 Ints Argument 1 (env $INTS1) | ||
INTS2 Ints Argument 2 (env $INTS2) (default [1, 2, 3]) | ||
INTS3 Ints Argument 3 (env $INTS3) | ||
|
||
Options: | ||
-b, --bool1 Bool Option 1 (env $BOOL1) | ||
--bool2 Bool Option 2 (default true) | ||
-d Bool Option 3 (env $BOOL3) | ||
-s, --str1 String Option 1 (env $STR1) | ||
--str2 String Option 2 (default "a value") | ||
-u String Option 3 (env $STR3) | ||
-i, --int1 (env $INT1, $ALIAS_INT1) (default 0) | ||
--int2 Int Option 2 (env $INT2) (default 1) | ||
-k Int Option 3 (env $INT3) | ||
-x, --strs1 Strings Option 1 (env $STRS1) | ||
--strs2 Strings Option 2 (env $STRS2) (default ["value1", "value2"]) | ||
-z Strings Option 3 (env $STRS3) | ||
-q, --ints1 Ints Option 1 (env $INTS1) | ||
--ints2 Ints Option 2 (env $INTS2) (default [1, 2, 3]) | ||
-s Ints Option 3 (env $INTS3) | ||
|
||
Commands: | ||
command1 command1 description | ||
command2 command2 description | ||
command3 command3 description | ||
|
||
Run 'app COMMAND --help' for more information on a command. |
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,10 @@ | ||
|
||
Usage: app [-o] ARG | ||
|
||
Longer App Desc | ||
|
||
Arguments: | ||
ARG Argument | ||
|
||
Options: | ||
-o, --opt Option |
Oops, something went wrong.