Skip to content

Commit ba189c3

Browse files
committed
Merge branch 're/submodule-parse-opt' into seen
"git submodule" learned various ways to spell the same option, e.g. "--branch=B" can be spelled "--branch B" or "-bB". * re/submodule-parse-opt: git-submodule.sh: improve parsing of short options git-submodule.sh: improve parsing of some long options git-submodule.sh: make some variables boolean
2 parents 5398b19 + c546f26 commit ba189c3

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

git-submodule.sh

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,14 @@ cmd_add()
7777
branch=$2
7878
shift
7979
;;
80+
-b*)
81+
branch="${1#-b}"
82+
;;
83+
--branch=*)
84+
branch="${1#--branch=}"
85+
;;
8086
-f | --force)
81-
force=$1
87+
force=1
8288
;;
8389
-q|--quiet)
8490
quiet=1
@@ -110,6 +116,9 @@ cmd_add()
110116
custom_name=$2
111117
shift
112118
;;
119+
--name=*)
120+
custom_name="${1#--name=}"
121+
;;
113122
--depth)
114123
case "$2" in '') usage ;; esac
115124
depth="--depth=$2"
@@ -231,7 +240,7 @@ cmd_deinit()
231240
do
232241
case "$1" in
233242
-f|--force)
234-
force=$1
243+
force=1
235244
;;
236245
-q|--quiet)
237246
quiet=1
@@ -294,7 +303,7 @@ cmd_update()
294303
nofetch=1
295304
;;
296305
-f|--force)
297-
force=$1
306+
force=1
298307
;;
299308
-r|--rebase)
300309
rebase=1
@@ -346,6 +355,9 @@ cmd_update()
346355
jobs="--jobs=$2"
347356
shift
348357
;;
358+
-j*)
359+
jobs="--jobs=${1#-j}"
360+
;;
349361
--jobs=*)
350362
jobs=$1
351363
;;
@@ -425,6 +437,12 @@ cmd_set_branch() {
425437
branch=$2
426438
shift
427439
;;
440+
-b*)
441+
branch="${1#-b}"
442+
;;
443+
--branch=*)
444+
branch="${1#--branch=}"
445+
;;
428446
--)
429447
shift
430448
break
@@ -500,16 +518,20 @@ cmd_summary() {
500518
cached=1
501519
;;
502520
--files)
503-
files="$1"
521+
files=1
504522
;;
505523
--for-status)
506-
for_status="$1"
524+
for_status=1
507525
;;
508526
-n|--summary-limit)
509527
summary_limit="$2"
510528
isnumber "$summary_limit" || usage
511529
shift
512530
;;
531+
-n*)
532+
summary_limit="${1#-n}"
533+
isnumber "$summary_limit" || usage
534+
;;
513535
--summary-limit=*)
514536
summary_limit="${1#--summary-limit=}"
515537
isnumber "$summary_limit" || usage

0 commit comments

Comments
 (0)