From: Stephen Rothwell Date: Thu, 21 Aug 2025 02:00:42 +0000 (+1000) Subject: message_helper: use getopts X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=2de6db0abe0b910e4c0a928056e2b73344c5c97c;p=next-scripts message_helper: use getopts --- diff --git a/message_helper b/message_helper index 35b6009..32ee641 100755 --- a/message_helper +++ b/message_helper @@ -9,16 +9,16 @@ if [ -f merge.log ]; then fi branch= -if [ "$1" = '-b' ]; then - branch="$2" - shift 2 -fi - kconfig= -if [ "$1" = '-c' ]; then - kconfig="$2" - shift 2 -fi + +while getopts 'b:c:' opt; do + case "$opt" in + b) branch="$OPTARG" ;; + c) kconfig="$OPTARG" ;; + *) printf '%s: bad option' "$0"; exit 1 ;; + esac +done +shift $(( OPTIND - 1 )) subject="$1" shift