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

a compdef for FreeBSD's sysctl(8) command



Hi,

Attached is a compdef for FreeBSD's sysctl(8) command which gets or
sets kernel state.  It was reviewed in a public mailing list.

Would you please merge this?

Thanks in advance.

-- 
                     /
                    /__  __            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 `uname -sr` in
FreeBSD\ [0-4].*)
    (( $+functions[_sysctl_variables] )) ||
    _sysctl_variables() {
	local ret=1 sup=' '

	(( $words[(I)-*w*] )) && sup='='

	compadd "$@" -S $sup - $(sysctl -A | sed 's/:.*//') && ret=0

	return ret
    }

    _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)]' \
     '*:variable:_sysctl_variables'
    ;;
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)]' \
     '*:variable:compadd -S "" - $(sysctl -aN)'
    ;;
esac



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