File tree Expand file tree Collapse file tree 28 files changed +728
-26
lines changed
spec/fixtures/workspaces/flag-args-with-dash Expand file tree Collapse file tree 28 files changed +728
-26
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,31 @@ cli_upload_usage() {
133133 fi
134134}
135135
136+ # :command.normalize_input
137+ normalize_input () {
138+ local arg flags
139+
140+ while [[ $# -gt 0 ]]; do
141+ arg=" $1 "
142+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
143+ input+=(" ${BASH_REMATCH[1]} " )
144+ input+=(" ${BASH_REMATCH[2]} " )
145+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
146+ input+=(" ${BASH_REMATCH[1]} " )
147+ input+=(" ${BASH_REMATCH[2]} " )
148+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
149+ flags=" ${BASH_REMATCH[1]} "
150+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
151+ input+=(" -${flags: i: 1} " )
152+ done
153+ else
154+ input+=(" $arg " )
155+ fi
156+
157+ shift
158+ done
159+ }
160+
136161# :command.inspect_args
137162inspect_args () {
138163 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -382,7 +407,9 @@ initialize() {
382407run () {
383408 declare -A args
384409 declare -a other_args
385- parse_requirements " $@ "
410+ declare -a input
411+ normalize_input " $@ "
412+ parse_requirements " ${input[@]} "
386413
387414 if [[ $action == " download" ]]; then
388415 if [[ ${args[--help]} ]]; then
Original file line number Diff line number Diff line change @@ -52,6 +52,31 @@ download_usage() {
5252 fi
5353}
5454
55+ # :command.normalize_input
56+ normalize_input () {
57+ local arg flags
58+
59+ while [[ $# -gt 0 ]]; do
60+ arg=" $1 "
61+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
62+ input+=(" ${BASH_REMATCH[1]} " )
63+ input+=(" ${BASH_REMATCH[2]} " )
64+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
65+ input+=(" ${BASH_REMATCH[1]} " )
66+ input+=(" ${BASH_REMATCH[2]} " )
67+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
68+ flags=" ${BASH_REMATCH[1]} "
69+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
70+ input+=(" -${flags: i: 1} " )
71+ done
72+ else
73+ input+=(" $arg " )
74+ fi
75+
76+ shift
77+ done
78+ }
79+
5580# :command.inspect_args
5681inspect_args () {
5782 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -155,7 +180,9 @@ initialize() {
155180run () {
156181 declare -A args
157182 declare -a other_args
158- parse_requirements " $@ "
183+ declare -a input
184+ normalize_input " $@ "
185+ parse_requirements " ${input[@]} "
159186
160187 if [[ $action == " root" ]]; then
161188 root_command
Original file line number Diff line number Diff line change @@ -57,6 +57,31 @@ colorly_usage() {
5757 fi
5858}
5959
60+ # :command.normalize_input
61+ normalize_input () {
62+ local arg flags
63+
64+ while [[ $# -gt 0 ]]; do
65+ arg=" $1 "
66+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
67+ input+=(" ${BASH_REMATCH[1]} " )
68+ input+=(" ${BASH_REMATCH[2]} " )
69+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
70+ input+=(" ${BASH_REMATCH[1]} " )
71+ input+=(" ${BASH_REMATCH[2]} " )
72+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
73+ flags=" ${BASH_REMATCH[1]} "
74+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
75+ input+=(" -${flags: i: 1} " )
76+ done
77+ else
78+ input+=(" $arg " )
79+ fi
80+
81+ shift
82+ done
83+ }
84+
6085# :command.inspect_args
6186inspect_args () {
6287 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -188,7 +213,9 @@ initialize() {
188213run () {
189214 declare -A args
190215 declare -a other_args
191- parse_requirements " $@ "
216+ declare -a input
217+ normalize_input " $@ "
218+ parse_requirements " ${input[@]} "
192219
193220 if [[ $action == " root" ]]; then
194221 root_command
Original file line number Diff line number Diff line change @@ -113,6 +113,31 @@ ftp_download_usage() {
113113 fi
114114}
115115
116+ # :command.normalize_input
117+ normalize_input () {
118+ local arg flags
119+
120+ while [[ $# -gt 0 ]]; do
121+ arg=" $1 "
122+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
123+ input+=(" ${BASH_REMATCH[1]} " )
124+ input+=(" ${BASH_REMATCH[2]} " )
125+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
126+ input+=(" ${BASH_REMATCH[1]} " )
127+ input+=(" ${BASH_REMATCH[2]} " )
128+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
129+ flags=" ${BASH_REMATCH[1]} "
130+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
131+ input+=(" -${flags: i: 1} " )
132+ done
133+ else
134+ input+=(" $arg " )
135+ fi
136+
137+ shift
138+ done
139+ }
140+
116141# :command.inspect_args
117142inspect_args () {
118143 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -367,7 +392,9 @@ initialize() {
367392run () {
368393 declare -A args
369394 declare -a other_args
370- parse_requirements " $@ "
395+ declare -a input
396+ normalize_input " $@ "
397+ parse_requirements " ${input[@]} "
371398
372399 if [[ $action == " upload" ]]; then
373400 if [[ ${args[--help]} ]]; then
Original file line number Diff line number Diff line change @@ -160,6 +160,31 @@ ftp_logout_usage() {
160160 fi
161161}
162162
163+ # :command.normalize_input
164+ normalize_input () {
165+ local arg flags
166+
167+ while [[ $# -gt 0 ]]; do
168+ arg=" $1 "
169+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
170+ input+=(" ${BASH_REMATCH[1]} " )
171+ input+=(" ${BASH_REMATCH[2]} " )
172+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
173+ input+=(" ${BASH_REMATCH[1]} " )
174+ input+=(" ${BASH_REMATCH[2]} " )
175+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
176+ flags=" ${BASH_REMATCH[1]} "
177+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
178+ input+=(" -${flags: i: 1} " )
179+ done
180+ else
181+ input+=(" $arg " )
182+ fi
183+
184+ shift
185+ done
186+ }
187+
163188# :command.inspect_args
164189inspect_args () {
165190 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -530,7 +555,9 @@ initialize() {
530555run () {
531556 declare -A args
532557 declare -a other_args
533- parse_requirements " $@ "
558+ declare -a input
559+ normalize_input " $@ "
560+ parse_requirements " ${input[@]} "
534561
535562 if [[ $action == " download" ]]; then
536563 if [[ ${args[--help]} ]]; then
Original file line number Diff line number Diff line change @@ -243,6 +243,31 @@ cli_file_edit_usage() {
243243 fi
244244}
245245
246+ # :command.normalize_input
247+ normalize_input () {
248+ local arg flags
249+
250+ while [[ $# -gt 0 ]]; do
251+ arg=" $1 "
252+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
253+ input+=(" ${BASH_REMATCH[1]} " )
254+ input+=(" ${BASH_REMATCH[2]} " )
255+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
256+ input+=(" ${BASH_REMATCH[1]} " )
257+ input+=(" ${BASH_REMATCH[2]} " )
258+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
259+ flags=" ${BASH_REMATCH[1]} "
260+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
261+ input+=(" -${flags: i: 1} " )
262+ done
263+ else
264+ input+=(" $arg " )
265+ fi
266+
267+ shift
268+ done
269+ }
270+
246271# :command.inspect_args
247272inspect_args () {
248273 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -772,7 +797,9 @@ initialize() {
772797run () {
773798 declare -A args
774799 declare -a other_args
775- parse_requirements " $@ "
800+ declare -a input
801+ normalize_input " $@ "
802+ parse_requirements " ${input[@]} "
776803
777804 if [[ $action == " dir" ]]; then
778805 if [[ ${args[--help]} ]]; then
Original file line number Diff line number Diff line change @@ -152,6 +152,31 @@ cli_upload_usage() {
152152 fi
153153}
154154
155+ # :command.normalize_input
156+ normalize_input () {
157+ local arg flags
158+
159+ while [[ $# -gt 0 ]]; do
160+ arg=" $1 "
161+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
162+ input+=(" ${BASH_REMATCH[1]} " )
163+ input+=(" ${BASH_REMATCH[2]} " )
164+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
165+ input+=(" ${BASH_REMATCH[1]} " )
166+ input+=(" ${BASH_REMATCH[2]} " )
167+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
168+ flags=" ${BASH_REMATCH[1]} "
169+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
170+ input+=(" -${flags: i: 1} " )
171+ done
172+ else
173+ input+=(" $arg " )
174+ fi
175+
176+ shift
177+ done
178+ }
179+
155180# :command.inspect_args
156181inspect_args () {
157182 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -438,7 +463,9 @@ initialize() {
438463run () {
439464 declare -A args
440465 declare -a other_args
441- parse_requirements " $@ "
466+ declare -a input
467+ normalize_input " $@ "
468+ parse_requirements " ${input[@]} "
442469
443470 if [[ $action == " download" ]]; then
444471 if [[ ${args[--help]} ]]; then
Original file line number Diff line number Diff line change @@ -172,6 +172,31 @@ cli_upload_usage() {
172172 fi
173173}
174174
175+ # :command.normalize_input
176+ normalize_input () {
177+ local arg flags
178+
179+ while [[ $# -gt 0 ]]; do
180+ arg=" $1 "
181+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
182+ input+=(" ${BASH_REMATCH[1]} " )
183+ input+=(" ${BASH_REMATCH[2]} " )
184+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
185+ input+=(" ${BASH_REMATCH[1]} " )
186+ input+=(" ${BASH_REMATCH[2]} " )
187+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
188+ flags=" ${BASH_REMATCH[1]} "
189+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
190+ input+=(" -${flags: i: 1} " )
191+ done
192+ else
193+ input+=(" $arg " )
194+ fi
195+
196+ shift
197+ done
198+ }
199+
175200# :command.inspect_args
176201inspect_args () {
177202 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -547,7 +572,9 @@ initialize() {
547572run () {
548573 declare -A args
549574 declare -a other_args
550- parse_requirements " $@ "
575+ declare -a input
576+ normalize_input " $@ "
577+ parse_requirements " ${input[@]} "
551578
552579 if [[ $action == " completions" ]]; then
553580 if [[ ${args[--help]} ]]; then
Original file line number Diff line number Diff line change @@ -159,6 +159,31 @@ configly_list_usage() {
159159 fi
160160}
161161
162+ # :command.normalize_input
163+ normalize_input () {
164+ local arg flags
165+
166+ while [[ $# -gt 0 ]]; do
167+ arg=" $1 "
168+ if [[ $arg =~ ^(--[^= ]+)= (.+)$ ]]; then
169+ input+=(" ${BASH_REMATCH[1]} " )
170+ input+=(" ${BASH_REMATCH[2]} " )
171+ elif [[ $arg =~ ^(-[^= ])= (.+)$ ]]; then
172+ input+=(" ${BASH_REMATCH[1]} " )
173+ input+=(" ${BASH_REMATCH[2]} " )
174+ elif [[ $arg =~ ^-([^-]..+)$ ]]; then
175+ flags=" ${BASH_REMATCH[1]} "
176+ for (( i= 0 ; i < ${# flags} ; i++ )) ; do
177+ input+=(" -${flags: i: 1} " )
178+ done
179+ else
180+ input+=(" $arg " )
181+ fi
182+
183+ shift
184+ done
185+ }
186+
162187# :command.inspect_args
163188inspect_args () {
164189 readarray -t sorted_keys < <( printf ' %s\n' " ${! args[@]} " | sort)
@@ -618,7 +643,9 @@ initialize() {
618643run () {
619644 declare -A args
620645 declare -a other_args
621- parse_requirements " $@ "
646+ declare -a input
647+ normalize_input " $@ "
648+ parse_requirements " ${input[@]} "
622649
623650 if [[ $action == " set" ]]; then
624651 if [[ ${args[--help]} ]]; then
You can’t perform that action at this time.
0 commit comments