Skip to content

Commit b3b6a7c

Browse files
committed
fix(_comp_split,_comp_compgen): strip periods from error message
1 parent 9cd43fe commit b3b6a7c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

bash_completion

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ _comp_split()
371371
done
372372
shift "$((OPTIND - 1))"
373373
if (($# != 2)); then
374-
printf '%s\n' "bash_completion: $FUNCNAME: unexpected number of arguments." >&2
374+
printf '%s\n' "bash_completion: $FUNCNAME: unexpected number of arguments" >&2
375375
printf '%s\n' "usage: $FUNCNAME [-a] [-F SEP] ARRAY_NAME TEXT" >&2
376376
return 2
377377
elif [[ $1 == @(*[^_a-zA-Z0-9]*|[0-9]*|''|_*|IFS|OPTIND|OPTARG|OPTERR) ]]; then
378-
printf '%s\n' "bash_completion: $FUNCNAME: invalid array name '$1'." >&2
378+
printf '%s\n' "bash_completion: $FUNCNAME: invalid array name '$1'" >&2
379379
return 2
380380
fi
381381

@@ -518,7 +518,7 @@ _comp_compgen()
518518
a) _append=set ;;
519519
v)
520520
if [[ $OPTARG == @(*[^_a-zA-Z0-9]*|[0-9]*|''|_*|IFS|OPTIND|OPTARG|OPTERR) ]]; then
521-
printf 'bash_completion: %s: -v: invalid array name `%s'\''.\n' "$FUNCNAME" "$OPTARG" >&2
521+
printf 'bash_completion: %s: -v: invalid array name `%s'\''\n' "$FUNCNAME" "$OPTARG" >&2
522522
return 2
523523
fi
524524
_var=$OPTARG
@@ -529,7 +529,7 @@ _comp_compgen()
529529
R) _cur="" ;;
530530
C)
531531
if [[ ! $OPTARG ]]; then
532-
printf 'bash_completion: %s: -C: invalid directory name `%s'\''.\n' "$FUNCNAME" "$OPTARG" >&2
532+
printf 'bash_completion: %s: -C: invalid directory name `%s'\''\n' "$FUNCNAME" "$OPTARG" >&2
533533
return 2
534534
fi
535535
_dir=$OPTARG
@@ -543,15 +543,15 @@ _comp_compgen()
543543
[[ $_old_nocasematch ]] && shopt -s nocasematch
544544
shift "$((OPTIND - 1))"
545545
if (($# == 0)); then
546-
printf 'bash_completion: %s: unexpected number of arguments.\n' "$FUNCNAME" >&2
546+
printf 'bash_completion: %s: unexpected number of arguments\n' "$FUNCNAME" >&2
547547
printf 'usage: %s [-alR|-F SEP|-v ARR|-c CUR] -- ARGS...' "$FUNCNAME" >&2
548548
return 2
549549
fi
550550

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

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

0 commit comments

Comments
 (0)