On Sat, Feb 19, 2011 at 9:20 PM, d...@ucore.info <d...@ucore.info> wrote:
> > I can script in Bash quite well, but I've never did anything that > fancy with completion and I don't know how to plug my function to > handle this. I understand that I should register something (function > named like _bookmarkcomp) to handle filename completion for things > beginning with %. > > If you help me with this one I promise to post my solution for benefit > of other bash users. > > Regards, > Dawid > -- > http://dpc.ucore.info > > I can give you an example here: bash# vi compgen-example.sh _compgen_foo() { local cmd=$1 cur=$2 pre=$3 if [[ $cur = % ]]; then COMPREPLY[0]='it-works' fi } complete -F _compgen_foo foo bash# source compgen-example.sh bash# foo %<TAB> <-- Press TAB here bash# foo it-works <-- `%' will be expanded like this -- Clark J. Wang