diff --git a/README.md b/README.md index d846c9f..5d88a3b 100644 --- a/README.md +++ b/README.md @@ -457,6 +457,7 @@ They are available only in the `getoptions` and `getoptions_help` functions. - switches (SWITCH) - Options - attributes (KEY-VALUE) + - `abbr`:BOOLEAN - Enable the abbreviated option - `counter`:BOOLEAN - Counts the number of flags - `export`:BOOLEAN - Export variables - `hidden`:BOOLEAN - Do not display in help @@ -478,6 +479,7 @@ They are available only in the `getoptions` and `getoptions_help` functions. - switches (SWITCH) - Options - attributes (KEY-VALUE) + - `abbr`:BOOLEAN - Enable the abbreviated option - `export`:BOOLEAN - Export variables - `hidden`:BOOLEAN - Do not display in help - `init`:[@INIT-VALUE | =STRING | CODE] - Initial value @@ -497,6 +499,7 @@ They are available only in the `getoptions` and `getoptions_help` functions. - switches (SWITCH) - Options - attributes (KEY-VALUE) + - `abbr`:BOOLEAN - Enable the abbreviated option - `export`:BOOLEAN - Export variables - `hidden`:BOOLEAN - Do not display in help - `init`:[@INIT-VALUE | =STRING | CODE] - Initial value @@ -518,6 +521,7 @@ They are available only in the `getoptions` and `getoptions_help` functions. - switches (SWITCH) - Options - attributes (KEY-VALUE) + - `abbr`:BOOLEAN - Enable the abbreviated option - `hidden`:BOOLEAN - Do not display in help - `label`:STRING - Option part of help message - message (STRING) diff --git a/lib/getoptions_abbr.sh b/lib/getoptions_abbr.sh index 2d0a302..d136b56 100644 --- a/lib/getoptions_abbr.sh +++ b/lib/getoptions_abbr.sh @@ -10,7 +10,7 @@ getoptions_abbr() { _3 'esac' } args() { - hidden='' + abbr=1 shift for i; do case $i in @@ -18,7 +18,7 @@ getoptions_abbr() { [!-+]*) eval "${i%%:*}=\${i#*:}" esac done - [ "$hidden" ] && return 0 + [ "$abbr" ] || return 0 for i; do case $i in diff --git a/spec/getoptions_abbr_spec.sh b/spec/getoptions_abbr_spec.sh index b25201b..9b4ea94 100644 --- a/spec/getoptions_abbr_spec.sh +++ b/spec/getoptions_abbr_spec.sh @@ -90,11 +90,11 @@ Describe "getoptions_abbr()" End End - Context "when hide attribute specified" + Context "when abbr attribute not specified" parser_definition() { setup ARGS abbr:true - flag FLAG --flag -- hidden - param PARAM --param hidden:true + flag FLAG --flag -- abbr: + param PARAM --param abbr: } It "does not treat as an abbreviation option"