Skip to content

Commit e6c3e34

Browse files
Roy Eldargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b71687c commit e6c3e34

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

git-submodule.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ cmd_add()
7777
branch=$2
7878
shift
7979
;;
80+
-b*)
81+
branch="${1#-b}"
82+
;;
8083
--branch=*)
8184
branch="${1#--branch=}"
8285
;;
@@ -352,6 +355,9 @@ cmd_update()
352355
jobs="--jobs=$2"
353356
shift
354357
;;
358+
-j*)
359+
jobs="--jobs=${1#-j}"
360+
;;
355361
--jobs=*)
356362
jobs=$1
357363
;;
@@ -431,6 +437,9 @@ cmd_set_branch() {
431437
branch=$2
432438
shift
433439
;;
440+
-b*)
441+
branch="${1#-b}"
442+
;;
434443
--branch=*)
435444
branch="${1#--branch=}"
436445
;;
@@ -519,6 +528,10 @@ cmd_summary() {
519528
isnumber "$summary_limit" || usage
520529
shift
521530
;;
531+
-n*)
532+
summary_limit="${1#-n}"
533+
isnumber "$summary_limit" || usage
534+
;;
522535
--summary-limit=*)
523536
summary_limit="${1#--summary-limit=}"
524537
isnumber "$summary_limit" || usage

0 commit comments

Comments
 (0)