help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Command completion for an alias


From: Chet Ramey
Subject: Re: [Help-bash] Command completion for an alias
Date: Thu, 04 Jun 2015 12:09:16 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 5/30/15 1:01 PM, Eduardo A. Bustamante López wrote:

> There is a fundamental problem with what you request though. Alias are simple
> text substitutions that can expand to anything. If you have:
> 
> sc=status
> alias gs='git "$sc"'
> 
> Then, is this new feature that you propose supposed to somehow evaluate the
> code and determine that you're completing 'git status'?

I would say no.  If you're going to use that, you get the same thing that
you would if you try to complete `git "$sc" '.  If the existing completion
function does the expansion for you, great; if not, you're stuck with what
it can do.

The bigger problem is when you try to complete an alias that expands into
something that contains shell metacharacters.  Since the expanded alias is
reparsed, it can contain characters like `&' that change the command
itself beyond what the proposed solutions handle.  That ends up being an
exercise in expectation management.

-- 
``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]