Skip to content

Commit 1ed394e

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

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
@@ -2060,13 +2060,13 @@ _known_hosts_real()
20602060
$reset
20612061

20622062
if ((${#COMPREPLY[@]})); then
2063-
if [[ $ipv4 ]]; then
2063+
if "$ipv4"; then
20642064
COMPREPLY=("${COMPREPLY[@]/*:*$suffix/}")
20652065
fi
2066-
if [[ $ipv6 ]]; then
2066+
if "$ipv6"; then
20672067
COMPREPLY=("${COMPREPLY[@]/+([0-9]).+([0-9]).+([0-9]).+([0-9])$suffix/}")
20682068
fi
2069-
if [[ $ipv4 || $ipv6 ]]; then
2069+
if "$ipv4" || "$ipv6"; then
20702070
for i in "${!COMPREPLY[@]}"; do
20712071
[[ ${COMPREPLY[i]} ]] || unset -v 'COMPREPLY[i]'
20722072
done

0 commit comments

Comments
 (0)