-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, May 08, 2005 at 05:46:10PM +0200, wmi-devel_AT_lists.berlios.de wrote:
> Hi,
> does anyone plan to do a bash-completion for wmir?
> Or for any other shell? :)
> Would be really helpful :)
> Greetings
> Olly
- ---end quoted text---
maybe too late, but I have one (:
this code is very simple and ugly, but it works fine for me.
_wmiir_path_complete()
{
COMPREPLY=()
local cur
cur=${COMP_WORDS[COMP_CWORD]}
[ "$COMP_CWORD" -eq 1 ] && COMPREPLY=( $( compgen -W 'read write create remove' -- $cur ) )
[ "$COMP_CWORD" -ge 2 ] && {
[ -z $cur ] && COMPREPLY=("/") || {
local path
path=`dirname ${cur}__`
path=$(wmiir read $path |
sed -r 's/(.).+ ([^ ]+)$/\2 \1/; s/ -$//; s/ d$/\//' |
while read I; do echo "$path/$I"; done |
sed 's/\/\//\//')
path=`echo -n $path`
COMPREPLY=( $( compgen -W "$path" -- $cur ))
}
}
}
complete -o nospace -o filenames -F _wmiir_path_complete wmiir
-----BEGIN PGP SIGNATURE-----
iD8DBQFEUnkhXdMH9oLAFG8RAu0NAJ9h9c5XoTCeWqwmcu5MGdZPKA2hsACgjd7p
0ZS1VBTDTnOM+0p4FmucQkg=
=1bGL
-----END PGP SIGNATURE-----
Received on Fri Apr 28 2006 - 22:21:21 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:04:01 UTC