Skip to content

Commit 9bccd49

Browse files
committed
refactor(_known_hosts_real): turn ipv{4,6} into boolean variables
1 parent c3f6bcf commit 9bccd49

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
@@ -1868,7 +1868,7 @@ _included_ssh_config_files()
18681868
_known_hosts_real()
18691869
{
18701870
local configfile="" flag prefix=""
1871-
local cur suffix="" aliases="" i host ipv4="" ipv6=""
1871+
local cur suffix="" aliases="" i host ipv4=false ipv6=false
18721872
local -a kh tmpkh=() khd=() config=()
18731873

18741874
# TODO remove trailing %foo from entries
@@ -1886,8 +1886,8 @@ _known_hosts_real()
18861886
configfile=$OPTARG
18871887
;;
18881888
p) prefix=$OPTARG ;;
1889-
4) ipv4=1 ;;
1890-
6) ipv6=1 ;;
1889+
4) ipv4=true ;;
1890+
6) ipv6=true ;;
18911891
*)
18921892
echo "bash_completion: $FUNCNAME: usage error" >&2
18931893
return 1
@@ -2062,13 +2062,13 @@ _known_hosts_real()
20622062
$reset
20632063

20642064
if ((${#COMPREPLY[@]})); then
2065-
if [[ $ipv4 ]]; then
2065+
if "$ipv4"; then
20662066
COMPREPLY=("${COMPREPLY[@]/*:*$suffix/}")
20672067
fi
2068-
if [[ $ipv6 ]]; then
2068+
if "$ipv6"; then
20692069
COMPREPLY=("${COMPREPLY[@]/+([0-9]).+([0-9]).+([0-9]).+([0-9])$suffix/}")
20702070
fi
2071-
if [[ $ipv4 || $ipv6 ]]; then
2071+
if "$ipv4" || "$ipv6"; then
20722072
for i in "${!COMPREPLY[@]}"; do
20732073
[[ ${COMPREPLY[i]} ]] || unset -v 'COMPREPLY[i]'
20742074
done

0 commit comments

Comments
 (0)