diff mbox series

[v2,2/8] git-submodule.sh: improve parsing of some long options

Message ID 20241209165009.40653-3-royeldar0@gmail.com (mailing list archive)
State Superseded
Headers show
Series git-submodule.sh: improve parsing of options | expand

Commit Message

Roy Eldar Dec. 9, 2024, 4:50 p.m. UTC
Some command-line options have a long form which takes an argument. In
this case, the argument can be given right after `='; for example,
"--depth" takes a numerical argument, which can be given as "--depth=X".

Support the case where the argument is given right after `=' for all
long options, in order to improve consistency throughout the script.

Signed-off-by: Roy Eldar <royeldar0@gmail.com>
---
 git-submodule.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/git-submodule.sh b/git-submodule.sh
index 107011f613..a47d2a89f3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -77,6 +77,9 @@  cmd_add()
 			branch=$2
 			shift
 			;;
+		--branch=*)
+			branch="${1#--branch=}"
+			;;
 		-f | --force)
 			force=1
 			;;
@@ -110,6 +113,9 @@  cmd_add()
 			custom_name=$2
 			shift
 			;;
+		--name=*)
+			custom_name="${1#--name=}"
+			;;
 		--depth)
 			case "$2" in '') usage ;; esac
 			depth="--depth=$2"
@@ -425,6 +431,9 @@  cmd_set_branch() {
 			branch=$2
 			shift
 			;;
+		--branch=*)
+			branch="${1#--branch=}"
+			;;
 		--)
 			shift
 			break