Skip to content

Commit 0cd3bce

Browse files
authored
Merge pull request #991 from scop/fix/ip-addresses-colons
fix: IPv6 colon handling issues
2 parents ea13241 + 8508d1d commit 0cd3bce

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

bash_completion

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,8 @@ _configured_interfaces()
15061506
}
15071507

15081508
# Local IP addresses.
1509+
# If producing IPv6 completions, `_comp_initialize` with `-n :`.
1510+
#
15091511
# -4: IPv4 addresses only (default)
15101512
# -6: IPv6 addresses only
15111513
# -a: All addresses
@@ -1526,6 +1528,7 @@ _ip_addresses()
15261528
command sed -e 's/[[:space:]]addr:/ /' -ne \
15271529
"s|.*inet${n}[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p")
15281530
_comp_compgen -a -- -W "$addrs"
1531+
[[ ! $n ]] || _comp_ltrim_colon_completions "$cur"
15291532
}
15301533

15311534
# This function completes on available kernels

completions/curl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
_comp_cmd_curl()
44
{
55
local cur prev words cword comp_args
6-
_comp_initialize -- "$@" || return
6+
_comp_initialize -n : -- "$@" || return
77

88
local noargopts='!(-*|*[KbcDoTCFmQreYytzuAwEdHPxX]*)'
99
# shellcheck disable=SC2254

completions/iperf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ _comp_cmd_iperf()
3737
--bind | -${noargopts}B)
3838
_available_interfaces -a
3939
_ip_addresses -a
40-
_comp_ltrim_colon_completions "$cur"
4140
return
4241
;;
4342
--bind-dev)

completions/links

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ _comp_cmd_links()
4747
;;
4848
-bind-address-ipv6)
4949
_ip_addresses -6
50-
_comp_ltrim_colon_completions "$cur"
5150
return
5251
;;
5352
-async-dns | -download-utime | -aggressive-cache | -only-proxies | \

completions/nc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ _comp_cmd_nc()
1212
-*s)
1313
if [[ ${words[*]} == *-6* ]]; then
1414
_ip_addresses -6
15-
_comp_ltrim_colon_completions "$cur"
1615
else
1716
_ip_addresses
1817
fi

0 commit comments

Comments
 (0)