Seit heute ist im offiziellen Paket von pacman fuer Arch Linux auch eine Autovervollstaendigung fuer die ZSH dabei:
pacman -Ql pacman|grep zsh pacman /usr/share/zsh/ pacman /usr/share/zsh/site-functions/ pacman /usr/share/zsh/site-functions/_pacman
Ich hatte das zwar schon vorher, musste aber nach einem Upgrade die Dateien von Hand patchen, da sich Pfade geaendert hatten. Nun ist es super das bei pacman dabei zu haben. ![]()
Zudem habe ich mir vor ein paar Wochen auf Basis des Codes aus AUR eine Vervollstaendigung fuer netcfg2 gebastelt:
#compdef netcfg2
local expl list intf sep
local -a disp
case $OSTYPE in
aix*)
intf=( ${(f)"$(lsdev -C -c if -F 'name:description')"} )
if zstyle -T ":completion:${curcontext}" verbose; then
zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-
zformat -a list " $sep " "$intf[@]"
disp=(-ld list)
fi
;;
darwin*|freebsd*|dragonfly*) intf=( $(ifconfig -l) ) ;;
irix*) intf=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;;
linux*) intf=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) ) ;;
*) intf=( $(ifconfig -a|sed -n 's/^\([^ :]*\).*/\1/p') ) ;;
esac
_arguments -C \
'*:profile:->profilelist' \
'-d[Take specified profile down]:profile:->profilelist' \
'-a[Take all profiles down]' \
'-c[Do not start profile if interface is already up]:profile:->profilelist' \
'-i[Take down profile active on specified interface]:interface:->interfaces'
if [[ "$state" = profilelist ]]; then
_description path_files expl 'Netwok Profiles'
_path_files "$expl[@]" -W '/etc/network.d' -g '*~*template'
fi
if [[ "$state" = interfaces ]]; then
_wanted interfaces expl 'network interface' compadd "$@" "$disp[@]" - "${(@)intf%%:*}"
fi
local expl list intf sep
local -a disp
case $OSTYPE in
aix*)
intf=( ${(f)"$(lsdev -C -c if -F 'name:description')"} )
if zstyle -T ":completion:${curcontext}" verbose; then
zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-
zformat -a list " $sep " "$intf[@]"
disp=(-ld list)
fi
;;
darwin*|freebsd*|dragonfly*) intf=( $(ifconfig -l) ) ;;
irix*) intf=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;;
linux*) intf=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) ) ;;
*) intf=( $(ifconfig -a|sed -n 's/^\([^ :]*\).*/\1/p') ) ;;
esac
_arguments -C \
'*:profile:->profilelist' \
'-d[Take specified profile down]:profile:->profilelist' \
'-a[Take all profiles down]' \
'-c[Do not start profile if interface is already up]:profile:->profilelist' \
'-i[Take down profile active on specified interface]:interface:->interfaces'
if [[ "$state" = profilelist ]]; then
_description path_files expl 'Netwok Profiles'
_path_files "$expl[@]" -W '/etc/network.d' -g '*~*template'
fi
if [[ "$state" = interfaces ]]; then
_wanted interfaces expl 'network interface' compadd "$@" "$disp[@]" - "${(@)intf%%:*}"
fi
Das Ganze sollte in der Datei /usr/share/zsh/site-functions/_netcfg2 abgelegt werden.
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Quicksearch
Kategorien
Tags
android bad world blog blogging browser changes code comic computer contentmanagement encryption feedreader firefox free fun google gui hardware howto html im jabber java life lighttpd linux linux&unix markup media misc mobile murphy networking newsbeuter opensource picture politics presentation privacy programming regular expression rss ruby s9y scala screenshot sdk security server shortys software stuff tail -f /var/log/life test tool tv unix video web webdesign webwide windows xml zeitgeist


