Skip to content

Commit ccdf953

Browse files
committed
feat(_ip_addresses): auto ltrim colon completions when appropriate
Initializing the completion with `-n :` is still needed.
1 parent 5d57dd0 commit ccdf953

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
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, use `-n :' to `_comp_initialize`.
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/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)