From 606b0a937527e43cf952c41cb8970fca7db3a55b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Jun 2013 21:59:06 -0600 Subject: fix the usage text for several commands --- pbs-package-commit | 2 +- pbs-plumb-config | 17 +++++++++++++++-- pbs-plumb-download | 6 ++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pbs-package-commit b/pbs-package-commit index 7af6fc5..3b3dfe5 100755 --- a/pbs-package-commit +++ b/pbs-package-commit @@ -18,7 +18,7 @@ usage() { echo '' echo ' ====================== `git commit` usage ======================' echo '' - git commit -h + git commit -h 2>&1 || true } main() { diff --git a/pbs-plumb-config b/pbs-plumb-config index bbb733f..d885256 100755 --- a/pbs-plumb-config +++ b/pbs-plumb-config @@ -1,5 +1,7 @@ #!/bin/bash +. pbs-plumb-shlib + ## # Usage: list FILE # stdout: A newline-separated list of settings in FILE @@ -21,8 +23,19 @@ get() { git config --file "$file" -z --get "$setting" } +usage() { + echo "Usage: ${0##*/} COMMAND [COMMAND-ARGUMENTS]" + echo "Work with /etc/libretools.d/pbs-convert.conf" + echo + echo "Commands:" + echo " list List the variables set in the file" + echo " get VARNAME Get the value of VARNAME" +} + main() { - [[ $# < 1 ]] && { usage; return 1; } + in_array '-h' "$@" && { usage; return 0; } + [[ $# < 1 ]] && { usage >&2; return 1; } + local cmd=$1 shift @@ -35,7 +48,7 @@ main() { get "$file" "$@" return $?;; *) - usage + usage >&2 return 1;; esac } diff --git a/pbs-plumb-download b/pbs-plumb-download index e321343..1ba4e68 100755 --- a/pbs-plumb-download +++ b/pbs-plumb-download @@ -18,7 +18,13 @@ . libremessages +usage() { + echo "Usage: ${0##*/} SOURCE" + echo "Downloads a source as configured in pbs-convert.conf" +} + main() { + in_array '-h' "$@" && { usage; return 0; } [[ $# != 1 ]] && { usage; return 1; } local source=$1 local url="$(pbs-plumb-config get "source.$source.url")" -- cgit v1.2.2