diff options
author | Bob Badour <bbadour@google.com> | 2020-05-19 19:10:19 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-19 19:10:19 +0000 |
commit | 67082027911141766f3d3f1c438449f07f7d8b19 (patch) | |
tree | da581028905318f358769fc7bb6f8aa7373e2fb7 /examples/debug_output.sh | |
parent | c1b032f644fc1d07c002dbdb40a625f6369f23f4 (diff) | |
parent | 32260528c6f69472d26f87e02d33df7845f8293a (diff) | |
download | shflags-67082027911141766f3d3f1c438449f07f7d8b19.tar.gz |
Merge remote-tracking branch 'aosp/upstream-master' into mymerge am: 2e0d635a87 am: 3dac286b93 am: 7ef808bcfa am: 32260528c6
Change-Id: Ica82bc9d7f59e667bb401efef521088df410bd47
Diffstat (limited to 'examples/debug_output.sh')
-rwxr-xr-x | examples/debug_output.sh | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/examples/debug_output.sh b/examples/debug_output.sh index b3ecec2..a5e61c8 100755 --- a/examples/debug_output.sh +++ b/examples/debug_output.sh @@ -11,10 +11,10 @@ # $ ./debug_output.sh sing # $ ./debug_output.sh --debug sing -# source shflags -. ../src/shflags +# Source shflags. +. ../shflags -# define flags +# Define flags. DEFINE_boolean 'debug' false 'enable debug mode' 'd' FLAGS_HELP=`cat <<EOF commands: @@ -22,21 +22,17 @@ commands: sing: sing something EOF` - -debug() -{ +debug() { [ ${FLAGS_debug} -eq ${FLAGS_TRUE} ] || return echo "DEBUG: $@" >&2 } -die() { - [ $# -gt 0 ] && echo "error: $@" >&2 +die() { [ $# -gt 0 ] && echo "error: $@" >&2 flags_help exit 1 } - -# parse the command-line +# Parse the command-line. FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" |