From: Stephen Rothwell Date: Fri, 26 Jul 2019 00:40:07 +0000 (+1000) Subject: do_merge: switch to using getopts X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=fef951e94339667ae6d5c55dd8bc862b0f736970;p=next-scripts do_merge: switch to using getopts --- diff --git a/do_merge b/do_merge index 01d7f1c..1c91fe5 100755 --- a/do_merge +++ b/do_merge @@ -3,19 +3,20 @@ no_build=false start_from="" -[ "$1" = "-n" ] && { - shift - no_build=true -} -[ "$1" = "-s" ] && { - shift - start_from="$1" - [ -z "$start_from" ] && { - echo "-s requires a start tree" 1>&2 +while getopts 'ns:' opt; do + case "$opt" in + n) + no_build=true + ;; + s) + start_from="$OPTARG" + ;; + *) exit 1 - } - shift -} + ;; + esac +done +shift $((OPTIND - 1)) tool_dir=$(dirname "$0") . "$tool_dir/common.sh"