Skip to content

Commit ab8a976

Browse files
committed
refactor(_known_hosts_real): turn ipv{4,6} into boolean variables
1 parent 5eb6ff0 commit ab8a976

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bash_completion

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@ _included_ssh_config_files()
19301930
_known_hosts_real()
19311931
{
19321932
local configfile="" flag prefix=""
1933-
local cur suffix="" aliases="" i host ipv4="" ipv6=""
1933+
local cur suffix="" aliases="" i host ipv4=false ipv6=false
19341934
local -a kh tmpkh=() khd=() config=()
19351935

19361936
# TODO remove trailing %foo from entries
@@ -1948,8 +1948,8 @@ _known_hosts_real()
19481948
configfile=$OPTARG
19491949
;;
19501950
p) prefix=$OPTARG ;;
1951-
4) ipv4=1 ;;
1952-
6) ipv6=1 ;;
1951+
4) ipv4=true ;;
1952+
6) ipv6=true ;;
19531953
*)
19541954
echo "bash_completion: $FUNCNAME: usage error" >&2
19551955
return 1
@@ -2122,13 +2122,13 @@ _known_hosts_real()
21222122
$reset
21232123

21242124
if ((${#COMPREPLY[@]})); then
2125-
if [[ $ipv4 ]]; then
2125+
if "$ipv4"; then
21262126
COMPREPLY=("${COMPREPLY[@]/*:*$suffix/}")
21272127
fi
2128-
if [[ $ipv6 ]]; then
2128+
if "$ipv6"; then
21292129
COMPREPLY=("${COMPREPLY[@]/+([0-9]).+([0-9]).+([0-9]).+([0-9])$suffix/}")
21302130
fi
2131-
if [[ $ipv4 || $ipv6 ]]; then
2131+
if "$ipv4" || "$ipv6"; then
21322132
for i in "${!COMPREPLY[@]}"; do
21332133
[[ ${COMPREPLY[i]} ]] || unset -v 'COMPREPLY[i]'
21342134
done

0 commit comments

Comments
 (0)