Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: a compdef for FreeBSD's sysctl(8) command



I found some bugs in the previous version and fixed.

Please use the attached one.

Regards,

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Freeze this moment a little bit longer, make each impression
  a little bit stronger..  Experience slips away -- Time stand still"

#compdef sysctl

case $OSTYPE in
  freebsd[0-4].*)
    _arguments -s \
      '-a[list all]' \
      '-A[show all opaques (values suppressed)]' \
      '-b[binary output]' \
      '-n[show only variable values]' \
      '-w[write mode]' \
      '-X[show all opaques (entire values)]' \
      '*:sysctl variable:compadd ${words[(r)-w]:+-S=} $(sysctl -A | sed "/^[^a-z]/d;s/:.*//")'
  ;;
  freebsd[5-9].*)
    _arguments -s \
      '-a[list all]' \
      '-b[binary output]' \
      '-N[show only variable names]' \
      '-n[show only variable values]' \
      '-o[show opaques as well (values suppressed)]' \
      '-x[show opaques as well (entire values)]' \
      '*:sysctl variable:compadd -S "" - $(sysctl -aN)'
  ;;
  linux*)
    _arguments -A "-*" \
      '-n[show only variable values]' \
      '(-n -p -a -A)-w[write mode]' \
      '(-n -w -a -A *)-p[specify file to load sysctl settings from]:file:_files' \
      '(-n -w -p -A *)-a[list all]' \
      '(-n -w -p -a *)-A[list all in table form]' \
      '(-n -p -a -A)*:sysctl variable:_files -W /proc/sys'
  ;;
esac



Messages sorted by: Reverse Date, Date, Thread, Author