[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Bash autocomplete for qdbus
From: "John Tapsell" <johnflux () gmail ! com>
Date: 2007-10-14 11:35:40
Message-ID: 43d8ce650710140435o49404889jeec722c964892023 () mail ! gmail ! com
[Download RAW message or body]
Ah thanks Thiago! That now fixes the problem. An updated version below.
Is there a standard place to install a file with this function in
it, so that it can be installed nicely by a package?
#!/bin/bash
function _qdbus ()
{
COMPREPLY=()
#Get the currently typed word
cur="${COMP_WORDS[COMP_CWORD]}"
#Get the rest of the words
unset COMP_WORDS[COMP_CWORD]
if [[ ${#COMP_WORDS[*]} -lt 4 ]] ; then
#Run qdbus and get a list of all the possibilities, filtering
out everything but the actual method name (arguments etc)
options='$(${COMP_WORDS[*]} | sed -e "s/^.* \([^ ]*\)([^()]*)$/\1/")'
#Set the autocomplete replies, filtering for matches for the
currently typed word
COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )
fi
}
complete -F _qdbus qdbus
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic