Skip to content

Commit

Permalink
fix(_comp_split,_comp_compgen): strip periods from error message
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed May 28, 2023
1 parent 9cd43fe commit b3b6a7c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bash_completion
Expand Up @@ -371,11 +371,11 @@ _comp_split()
done
shift "$((OPTIND - 1))"
if (($# != 2)); then
printf '%s\n' "bash_completion: $FUNCNAME: unexpected number of arguments." >&2
printf '%s\n' "bash_completion: $FUNCNAME: unexpected number of arguments" >&2
printf '%s\n' "usage: $FUNCNAME [-a] [-F SEP] ARRAY_NAME TEXT" >&2
return 2
elif [[ $1 == @(*[^_a-zA-Z0-9]*|[0-9]*|''|_*|IFS|OPTIND|OPTARG|OPTERR) ]]; then
printf '%s\n' "bash_completion: $FUNCNAME: invalid array name '$1'." >&2
printf '%s\n' "bash_completion: $FUNCNAME: invalid array name '$1'" >&2
return 2
fi

Expand Down Expand Up @@ -518,7 +518,7 @@ _comp_compgen()
a) _append=set ;;
v)
if [[ $OPTARG == @(*[^_a-zA-Z0-9]*|[0-9]*|''|_*|IFS|OPTIND|OPTARG|OPTERR) ]]; then
printf 'bash_completion: %s: -v: invalid array name `%s'\''.\n' "$FUNCNAME" "$OPTARG" >&2
printf 'bash_completion: %s: -v: invalid array name `%s'\''\n' "$FUNCNAME" "$OPTARG" >&2
return 2
fi
_var=$OPTARG
Expand All @@ -529,7 +529,7 @@ _comp_compgen()
R) _cur="" ;;
C)
if [[ ! $OPTARG ]]; then
printf 'bash_completion: %s: -C: invalid directory name `%s'\''.\n' "$FUNCNAME" "$OPTARG" >&2
printf 'bash_completion: %s: -C: invalid directory name `%s'\''\n' "$FUNCNAME" "$OPTARG" >&2
return 2
fi
_dir=$OPTARG
Expand All @@ -543,15 +543,15 @@ _comp_compgen()
[[ $_old_nocasematch ]] && shopt -s nocasematch
shift "$((OPTIND - 1))"
if (($# == 0)); then
printf 'bash_completion: %s: unexpected number of arguments.\n' "$FUNCNAME" >&2
printf 'bash_completion: %s: unexpected number of arguments\n' "$FUNCNAME" >&2
printf 'usage: %s [-alR|-F SEP|-v ARR|-c CUR] -- ARGS...' "$FUNCNAME" >&2
return 2
fi

if [[ $1 != -* ]]; then
# usage: _comp_compgen [options] NAME args
if ! declare -F "_comp_compgen_$1" &>/dev/null; then
printf 'bash_completion: %s: unrecognized category `%s'\'' (function _comp_compgen_%s not found).\n' "$FUNCNAME" "$1" "$1" >&2
printf 'bash_completion: %s: unrecognized category `%s'\'' (function _comp_compgen_%s not found)\n' "$FUNCNAME" "$1" "$1" >&2
return 2
fi

Expand Down Expand Up @@ -599,7 +599,7 @@ _comp_compgen()
# "${*:2:_nopt}" becomes longer, so we test \$[0-9] and \$\{[0-9]
# separately.
if [[ $* == *\$[0-9]* || $* == *\$\{[0-9]* ]]; then
printf 'bash_completion: %s: positional parameter $1, $2, ... do not work inside this function.\n' "$FUNCNAME" >&2
printf 'bash_completion: %s: positional parameter $1, $2, ... do not work inside this function\n' "$FUNCNAME" >&2
return 2
fi

Expand Down

0 comments on commit b3b6a7c

Please sign in to comment.