i wrote a small completion function for wmi and wmiremote (WMI-10). It's
for the Z Shell (<http://www.zsh.org/>); *not* for Bash because Bash is
to lame
Note: If the manpage `actions.conf.5' is not in /usr/local/man/man5/,
simple change the path.
#compdef wmiremote
local expl
_wmi_actions() {
local a
a=( $(grep '^\\fB' /usr/local/man/man5/actions.conf.5 | grep -v conf | sed -e 's/:.*//' -e 's/^\\fB//') )
_wanted wmi-actions expl 'wmi actions' compadd "$@" -a - a
}
_arguments \
'-a[invokes an WMI action remotely]:wmi actions:_wmi_actions' \
'-d[display specifies the display to use]:display:_x_display' \
'-m[sets meters info (see manual page for details)]' \
'-p[prints current key bindings of running WMI]' \
'-t[displays bartext in the wmi]' \
'-v[prints out above version info]' \
#compdef wmi
_arguments \
'-h[help]' \
'-d[display specifies the display to use]:display:_x_display' \
'-v[prints out above version info]' \
To use this two functions, store it in two files (the files
must be named `_wmiremote' and `_wmi'!) and place it somewhere in your $fpath (see `man zshparam /fpath' for details). If you don't want (or don't have the permission) to add files into a directory in $fpath, you can create a directory in your home directory (i use ~/.zsh/func) and prepend that directory to the list in $fpath by adding these commands to your $HOME/.zshrc:
| autoload -U compinit ; compinit # initialize compinit
| fpath=(~/.zsh/func $fpath) # add ~/.zsh/func to $fpath
| autoload -U ~/.zsh/func/*(:t) # load all functions in ~/.zsh/func
That's all. When you next start zsh, the completion system will see the _wmi and _wmiremote completion function and now its ready.
$ wmiremote -<<AB>
-a -- invokes an WMI action remotely
-d -- display specifies the display to use
-m -- sets meters info (see manual page for details)
-p -- prints current key bindings of running WMI
-t -- displays bartext in the wmi
-v -- prints out above version info
$ wmiremote -a <TAB>
attach-all-clients end-record-script max-client-to-screen
...
$ wmiremote -d <TAB>
...
$ wmi -<TAB>
-d -- display specifies the display to use
-h -- help
-v -- prints out above version info
$ wmi -d <TAB>
Please report any bugs/problems to this list or to me. Have a lot of fun
Note: I posted it in
https://lists.berlios.de/pipermail/wmi-devel/2005-January/001827.html too but i know here are some
WMI-user read along.