mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
added descriptions to __fish_print_addresses
added --all flag to include 0.0.0.0 and :: adapted use of this function in existing completions fixes #7787
This commit is contained in:
parent
762f3aa0ce
commit
274be5eeeb
4 changed files with 10 additions and 17 deletions
|
@ -24,7 +24,7 @@ complete -c msfdb -l db-port -x -d 'Database port'
|
|||
complete -c msfdb -l db-pool -x -d 'Database connection pool size'
|
||||
|
||||
# Web Service Options
|
||||
complete -c msfdb -s a -l address -x -a "(__fish_print_addresses)" -d 'Bind to host address'
|
||||
complete -c msfdb -s a -l address -x -a "(__fish_print_addresses --all)" -d 'Bind to host address'
|
||||
complete -c msfdb -s p -l port -x -d 'Web service port'
|
||||
complete -c msfdb -l ssl -d 'Enable SSL'
|
||||
complete -c msfdb -l no-ssl -d 'Disable SSL'
|
||||
|
|
|
@ -18,19 +18,7 @@ complete -c ssh -n 'test (__fish_number_of_cmd_args_wo_opts) -ge 2' -d "Command
|
|||
complete -c ssh -s a -d "Disables forwarding of the authentication agent"
|
||||
complete -c ssh -s A -d "Enables forwarding of the authentication agent"
|
||||
|
||||
|
||||
function __ssh_print_local_addresses_with_labels
|
||||
if command -sq ip
|
||||
command ip --oneline address | string replace -r '\d+:\s+(\S+)\s+\S+\s+(.+)/.*' '$2\t$1'
|
||||
else if command -sq ifconfig
|
||||
# This is for OSX/BSD/anything else that doesn't have `ip` installed.
|
||||
# Since ifconfig output is not guaranteed to be the same on these systems,
|
||||
# for now we will limit the completions to just the IP address.
|
||||
# TODO: check ifconfig output on each system and rework below to include label.
|
||||
ifconfig | awk '/^\tinet/ { print $2 } '
|
||||
end
|
||||
end
|
||||
complete -x -c ssh -s b -d "Local address to bind to" -a '(__ssh_print_local_addresses_with_labels)'
|
||||
complete -x -c ssh -s b -d "Local address to bind to" -a '(__fish_print_addresses)'
|
||||
|
||||
complete -x -c ssh -s e -d "Escape character" -a "\^ none"
|
||||
complete -c ssh -s f -d "Go to background"
|
||||
|
|
|
@ -16,7 +16,7 @@ function __fish_complete_bittorrent
|
|||
complete -c $argv -l timeout_check_interval -x --description "Time between checking timeouts"
|
||||
complete -c $argv -l max_slice_length -x --description "Maximum outgoing slice length"
|
||||
complete -c $argv -l max_rate_period -x --description "Maximum time to guess rate"
|
||||
complete -c $argv -l bind -x --description "IP to bind to locally" -a "(__fish_print_addresses)"
|
||||
complete -c $argv -l bind -x --description "IP to bind to locally" -a "(__fish_print_addresses --all)"
|
||||
complete -c $argv -l display_interval -x --description "Time between screen updates"
|
||||
complete -c $argv -l rerequest_interval -x --description "Time to wait between requesting more peers"
|
||||
complete -c $argv -l min_peers -x --description "Minimum number of peers to not do requesting"
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
function __fish_print_addresses --description "Print a list of known network addresses"
|
||||
function __fish_print_addresses --description "List own network addresses with interface as description"
|
||||
# if --all is given, also print 0.0.0.0 and ::
|
||||
if contains -- --all $argv
|
||||
echo -e "0.0.0.0\tall"
|
||||
echo -e "::\tall"
|
||||
end
|
||||
if command -sq ip
|
||||
command ip --oneline address | string replace -r '(\S+\s+){3}(.+)/.*' '$2'
|
||||
command ip --oneline address | string replace -r '^\d+:\s+(\S+)\s+inet6?\s+([^\s/]+).*' '$2\t$1'
|
||||
else if command -sq ifconfig
|
||||
# This is for OSX/BSD
|
||||
# There's also linux ifconfig but that has at least two different output formats
|
||||
|
|
Loading…
Reference in a new issue