help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] [completion] Is it possible to auto complete one word in


From: Chet Ramey
Subject: Re: [Help-bash] [completion] Is it possible to auto complete one word into multiple ones?
Date: Wed, 29 Jul 2015 10:19:55 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1

On 7/27/15 4:24 AM, Clark Wang wrote:
> For example, the foo command has a ``--select all'' option but has no
> ``-a'' option. I want to define a compspec for foo so when I input ``foo
> -a'' and press <TAB> it'll replace ``-a'' with ``--select all''.

Make your completion function set COMPREPLY[0]='--select all' when
${COMP_WORDS[$COMP_CWORD]} == '-a' (or $2 == '-a').  Make it a special
case if you have to.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]