[dpdk-dev] [PATCH 1/2] devtools: standardize script arguments
Thomas Monjalon
thomas at monjalon.net
Sat Feb 22 21:53:02 CET 2020
Hi,
Thanks for improving tooling.
28/01/2020 16:02, Ciara Power:
> range=${1:-origin/master..}
If doing a real option management, range should be the remaining argument
after option parsing.
> +if [ "$range" = '--help' ] ; then
> + print_usage
Missing "exit 0" after usage.
> # convert -N to HEAD~N.. in order to comply with git-log-fixes.sh getopts
> -if printf -- $range | grep -q '^-[0-9]\+' ; then
> - range="HEAD$(printf -- $range | sed 's,^-,~,').."
> +elif printf -- "$range" | grep -q '^-[0-9]\+' ; then
> + range="HEAD$(printf -- "$range" | sed 's,^-,~,').."
getopts won't be called if $1 starts with -N.
I think it would be cleaner to handle this in "?" case below.
> +else
> + while getopts hr:n: ARG ; do
> + case $ARG in
> + n ) range="HEAD~$OPTARG.." ;;
> + r ) range=$OPTARG ;;
-r is not a git-log option.
Please handle it without the need for -r.
> + h ) print_usage ; exit 0 ;;
> + ? ) print_usage ; exit 1 ;;
> + esac
> + done
> + shift $(($OPTIND - 1))
More information about the dev
mailing list