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"