[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question. Autocomplete paths starting with %.
From: |
address@hidden |
Subject: |
Re: Question. Autocomplete paths starting with %. |
Date: |
Thu, 24 Feb 2011 13:46:51 +0100 |
On Wed, Feb 23, 2011 at 5:06 AM, Clark J. Wang <dearvoid@gmail.com> wrote:
> 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
Thanks.
However this only registers for foo. What if I wanted to handle % for
everything or even better ... only at places that expect the path? Any
way to force bash to do that?
Regards,
Dawid
--
http://dpc.ucore.info