diff options
author | Roy Eldar <royeldar0@gmail.com> | 2024-12-11 07:32:29 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-12-11 12:46:47 +0100 |
commit | e6c3e349458ec2ad36addc6004cffcfa6d663c38 (patch) | |
tree | 515a22a7ff513b3905ce36350e3b0753dee5159f | |
parent | git-submodule.sh: improve parsing of some long options (diff) | |
download | git-e6c3e349458ec2ad36addc6004cffcfa6d663c38.tar.xz git-e6c3e349458ec2ad36addc6004cffcfa6d663c38.zip |
git-submodule.sh: improve parsing of short options
Some command-line options have a short form which takes an argument; for
example, "--jobs" has the form "-j", and it takes a numerical argument.
When parsing short options, support the case where there is no space
between the flag and the option argument, in order to improve
consistency with the rest of the builtin git commands.
Signed-off-by: Roy Eldar <royeldar0@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | git-submodule.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index d3e3669fde..fd54cb8fa6 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -77,6 +77,9 @@ cmd_add() branch=$2 shift ;; + -b*) + branch="${1#-b}" + ;; --branch=*) branch="${1#--branch=}" ;; @@ -352,6 +355,9 @@ cmd_update() jobs="--jobs=$2" shift ;; + -j*) + jobs="--jobs=${1#-j}" + ;; --jobs=*) jobs=$1 ;; @@ -431,6 +437,9 @@ cmd_set_branch() { branch=$2 shift ;; + -b*) + branch="${1#-b}" + ;; --branch=*) branch="${1#--branch=}" ;; @@ -519,6 +528,10 @@ cmd_summary() { isnumber "$summary_limit" || usage shift ;; + -n*) + summary_limit="${1#-n}" + isnumber "$summary_limit" || usage + ;; --summary-limit=*) summary_limit="${1#--summary-limit=}" isnumber "$summary_limit" || usage |