-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script: Use pflag for command arguments
Embed the pflag FlagSet into the command creation so we can show decent help for the flags. Signed-off-by: Jussi Maki <[email protected]>
- Loading branch information
Showing
5 changed files
with
180 additions
and
63 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 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,36 @@ | ||
# Test help in various ways | ||
help | ||
help wait | ||
stdout wait | ||
help -v wait | ||
stdout wait | ||
help unknowncommand | ||
help ^e | ||
! stdout wait | ||
stdout ^exec | ||
stdout ^exists | ||
|
||
# Check the 'help' output of the 'stdout' command. | ||
# The 'cmp' has special handling for 'stdout' and 'stderr'. | ||
help stdout | ||
cmp stdout stdout_help.txt | ||
|
||
# The -h and --help are intercepted and we show the same | ||
# output as 'help' | ||
stdout -h | ||
cmp stdout stdout_help.txt | ||
stdout --help | ||
cmp stdout stdout_help.txt | ||
|
||
-- stdout_help.txt -- | ||
stdout [-q] [--count=int] [--quiet] 'pattern' | ||
find lines in the stdout buffer that match a pattern | ||
|
||
The command succeeds if at least one match (or the exact | ||
count, if given) is found. | ||
The -q flag suppresses printing of matches. | ||
|
||
Flags: | ||
--count int Exact count of matches | ||
-q, --quiet Suppress printing of matches | ||
|
Oops, something went wrong.