From ef9fb52908d3f423e6e537b84f62cb76c7868782 Mon Sep 17 00:00:00 2001 From: Dubiousjim Date: Fri, 5 Jul 2013 00:21:19 -0400 Subject: various: use long options, rework usages --- abump.in | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) (limited to 'abump.in') diff --git a/abump.in b/abump.in index 32ff4af..3b501e3 100755 --- a/abump.in +++ b/abump.in @@ -56,29 +56,48 @@ fixes #${fixes#\#} } usage() { - echo "$prog - utility to bump pkgver in APKBUILDs" - echo "usage: $prog [-hR] [-s CVE-1,CVE-2,...] [-f ISSUE]" - echo "" - echo " -h show this help" - echo " -R run abuild with -R for recursive building" - echo " -k keep existing packages" - echo " -s security update" - echo " -f fixes ISSUE" - exit 0 + cat >&2 <<__EOF__ +$prog $abuild_ver - bump pkgver in APKBUILDs +Usage: $prog [-s CVE-1,CVE-2,...] [-f ISSUE] [-R|--recursive] [-k|--keep] PKGNAME-1.2.3 ... +Options: + -s, --security CVE1,CVE-2,... Security update + -f, --fixes ISSUE Fixes ISSUE + -R, --recursive Run abuild with -R for recursive building + -k, --keep Run abuild with -k to keep existing packages + -q, --quiet + -h, --help Show this help + +__EOF__ } keep= recursive="-r" -while getopts "f:hkRs:" opt; do - case $opt in - f) fixes="${OPTARG}";; - h) usage;; - k) keep="-k";; - R) recursive="-R";; - s) cvelist="$OPTARG";; +cvelist= +fixes= + +args=`getopt -o s:Rkqh --long security:,recursive,keep,quiet,help -n "$prog" -- "$@"` +if [ $? -ne 0 ]; then + usage + exit 2 +fi +eval set -- "$args" +while true; do + case $1 in + -s|--security) cvelist="$2"; shift;; + -f|--fixes) fixes="$2"; shift;; + -R|--recursive) recursive="-R";; + -k|--keep) keep="-k";; + -q|--quiet) quiet=1;; # suppresses msg + -h|--help) usage; exit;; + --) shift; break;; + *) exit 1;; # getopt error esac + shift done -shift $(( $OPTIND - 1)) +if [ $# -eq 0 ]; then + usage + exit 2 +fi abuild_opts="$recursive $keep" -- cgit v1.2.3-60-g2f50