zsh-workers
 help / color / mirror / code / Atom feed
6042eaf1eb6df9551b736916b7cb68e1bc303f8c blob 634 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 
#autoload

# @todo In the future it might be useful to have this function take a glob or
# similar to filter out loop-back addresses, only return IPv4/6, etc.

local -a expl tmp cmd=( ifconfig -a )

# A lot of Linux systems have ifconfig, but this is probably safer (and it's
# parsed the same way)
[[ $OSTYPE == linux* ]] && (( $+commands[ip] )) && cmd=( ip addr show )

tmp=( ${(f)"$( _call_program bind-addresses $cmd )"} )
tmp=( ${(@M)tmp##(|[[:space:]]##)inet(|6)(|:)[[:space:]]*} )
tmp=( ${(@)tmp#*inet(|6)(|:)[[:space:]]##} )
tmp=( ${(@)tmp%%[^0-9A-Fa-f:.]*} )

_wanted bind-addresses expl 'bind address' compadd -a "$@" - tmp
debug log:

solving 6042eaf1e ...
found 6042eaf1e in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).