Merge Merge lp:~daniel-nichter/percona-toolkit/bash-tool-libs r135.

This commit is contained in:
Daniel Nichter
2011-12-19 12:53:09 -07:00
5 changed files with 160 additions and 105 deletions
+11 -2
View File
@@ -66,12 +66,21 @@ is "$OPT_VERSION" "yes" "Short form"
# Have to call this in a subshell because the error will cause an exit.
parse_options "$T_LIB_DIR/samples/bash/po001.sh" --foo >$TMPFILE 2>&1
is "`cat $TMPFILE`" "" "No warnings or errors yet"
cmd_ok "grep -q 'Unknown option: --foo' $TMPFILE" "Error on unknown option"
usage_or_errors "$T_LIB_DIR/samples/bash/po001.sh" >$TMPFILE 2>&1
local err=$?
is "$err" "1" "Non-zero exit on unknown option"
cmd_ok "grep -q 'Unknown option: --foo' $TMPFILE" "Error on unknown option"
# ###########################################################################
# --help
# ###########################################################################
parse_options "$T_LIB_DIR/samples/bash/po001.sh" --help
usage_or_errors "$T_LIB_DIR/samples/bash/po001.sh" >$TMPFILE 2>&1
no_diff \
"$TMPFILE" \
"$T_LIB_DIR/samples/bash/help001.txt" \
"--help"
# ############################################################################
# Done
+30
View File
@@ -0,0 +1,30 @@
Usage: pt-stalk [OPTIONS] [-- MYSQL_OPTIONS]
For more information, 'man pt-stalk' or 'perldoc /Users/daniel/p/bash-tool-libs/t/lib/samples/bash/po001.sh'.
Command line options:
--help
Print help and exit.
--int-opt
Int option without a default.
--int-opt2
Int option with a default.
--noption
Negatable option.
--string-opt
String option without a default.
--string-opt2
String option with a default.
--typeless-option
Just an option.
--version
Print tool's version and exit.
+7 -1
View File
@@ -110,11 +110,13 @@ Just an option.
default: yes; negatable: yes
Negatable option.
=item --int-opt
type: int
Int option without a default
Int option without a default.
=item --int-opt2
@@ -128,6 +130,10 @@ short form: -v
Print tool's version and exit.
=item --help
Print help and exit.
=back
=head1 ENVIRONMENT