blob: 0858b36757425d100dfab7fcaa4f32e08fff6509 [file] [log] [blame]
#!/bin/bash
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
## Intent: Parse command line switch, when *-not detected take action
## - remove substring '-not' modifier from switch name
## - set values in map %attrs=() to capture detection of NOT
## - switch value returned modified
## Return:
## %attrs ['not']=true
## -----------------------------------------------------------------------
function getopts_switch__not()
{
local -n gsn_arg=$1 ; shift
declare -g -A attrs
case "$gsn_arg" in
# -[-not]
'--not')
attrs['not']=1
gsn_argv=''
local -i rc=0
;;
# --reserved-is[-not]-empty
*'-not'*)
declare -a args=()
attrs['not']=1
gsn_arg="${gsn_arg/-not/}"
local -i rc=0
;;
*) local -i rc=1 ;;
esac
[[ $rc -eq 0 ]] && { true; } || { false; }
return
}
# [EOF]