Make argument parsing a bit more robust
Currently, when running mfh with a flag like --help the user gets a confusing error message from expr(1) like the following: > expr: illegal option -- - > expr: usage: expr [-e] expression > > revision "--help" should be a number This is not helpful. Instead, make sure that any arguments specified by the user are handled properly by expr(1). This results in a much cleaner error message: > revision "--help" should be a number Reviewed by: mat Approved by: portmgr (mat) Differential Revision: https://reviews.freebsd.org/D25958
This commit is contained in:
parent
1c843dbb6a
commit
4bd3723c02
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=544225
@ -85,7 +85,7 @@ else cdiffcmd=cat
|
||||
fi
|
||||
|
||||
# I sure hope by 2030 we'll be doing something else. Yes, famous last words.
|
||||
if expr "${branch}" : '20[12][0-9]Q[1-4]' > /dev/null; then
|
||||
if expr -- "${branch}" : '20[12][0-9]Q[1-4]' > /dev/null; then
|
||||
shift
|
||||
if [ "${latest_branch}" != "${branch}" ]; then
|
||||
ask "/!\\ The latest branch is ${latest_branch}, do you really want to commit to ${branch}?" || exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user