ZSH-Vervollstaendigung fuer Pacman und netcfg2

  • Impressum
  • Administration
  • Kontaktformular
  • Jabber
  • Tagcloud
  • Twitter
  • Soup
  • Github

roothausen

ZSH-Vervollstaendigung fuer Pacman und netcfg2

21:25

Wednesday, January 23. 2008

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
 

Das Ganze sollte in der Datei /usr/share/zsh/site-functions/_netcfg2 abgelegt werden.

Posted by admin in computer | Comment (1) | Trackbacks (0)
Defined tags for this entry: computer, linux&unix, opensource, shortys, software
Related entries by tags:
  • Mobile devices or: How I Learned to Stop Worrying and Love the iOS
  • The VP8 Video Codec
  • My Bachelor Thesis: Scale the realtime web
  • Distributed contact management using HTTP
  • Gesichtserkennung/Eigenfaces
< Die Zukunft in Deutschland | Spamhasser >

Trackbacks
Trackback specific URI for this entry

No Trackbacks

Comments
Display comments as (Linear | Threaded)

*Cool, dass die Completion jetzt dabei ist - hättest du hier nicht drüber geschrieben hätte ich es garnicht mitbekommen. Dabei wollte ich es mir schon selbst zusammenbasteln :-)

#1 Filzo (Homepage) on 2008-01-27 17:17 (Reply)

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Markdown format allowed
 
 

JavaScript String .fromCharCode

Calendar

« May '12 »
Mo Tu We Th Fr Sa Su
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Quicksearch

Kategorien

  • XML computer
  • XML misc
  • XML web
  • XML zeitgeist


All categories

Archiv

  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • Recent...
  • Older...

Feeds

  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 Comments

Links

Retinacast
Shackspace
Yaxim
Radio Tux
Kais Blog
Blumen Pfleiderer
Alk
paxos
filzo
Marc Seeger
polzifer
Moritz Haarmann

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

Lizenz

Creative Commons License - Some Rights Reserved