Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mbedsys
bashopts
Commits
a37489af
Commit
a37489af
authored
Jun 30, 2018
by
Emeric Verschuur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix enumeration type to support values with spaces
parent
10b57ec7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
bashopts.sh
bashopts.sh
+3
-3
No files found.
bashopts.sh
View file @
a37489af
...
...
@@ -19,7 +19,7 @@
set
-e
BASHOPTS_VERSION
=
2.1.
0
BASHOPTS_VERSION
=
2.1.
1
bashopts_exit_handle
()
{
local
err
=
$?
...
...
@@ -256,7 +256,7 @@ bashopts_declare() {
-l
)
options[long_opt]
=
$1
;
shift
;;
-d
)
options[description]
=
$1
;
shift
;;
-t
)
options[type]
=
$1
;
shift
;;
-e
)
options_enum_values+
=(
$1
)
;
shift
;;
-e
)
options_enum_values+
=(
"
$1
"
)
;
shift
;;
-m
)
options[method]
=
$1
;
shift
;;
-k
)
options[check]
=
$1
;
shift
;;
-s
)
options[setting]
=
"true"
;;
...
...
@@ -280,7 +280,7 @@ bashopts_declare() {
if
[
${#
options_enum_values
[@]
}
-lt
2
]
;
then
bashopts_log C
"bashopts_declare:
${
options
[name]
}
enumeration need at least two elements (two '-e <val>' calls at least)"
fi
options[enum_values]
=
"
$(
IFS
=
$'
\n
'
;
echo
"
${
options_enum_values
[
*
]
}
"
)
"
options[enum_values]
=
"
$(
printf
"%s
\n
"
"
${
options_enum_values
[
@
]
}
"
)
"
;;
s|str|string
)
options[type]
=
"string"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment