bug-bash
[Top][All Lists]
Advanced

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

Re: Using alias to commands disables its completion


From: Gustavo Serra Scalet
Subject: Re: Using alias to commands disables its completion
Date: Sun, 27 Mar 2011 11:42:57 -0300

First of all, thank you for the quick answer. I wasn't expecting that to be
so fast...

On 24 March 2011 16:54, Eric Blake <address@hidden> wrote:

> The lame answer:
>
> But you can already do this yourself!  Write a shell function around
> alias, that calls both 'command alias' to do the real work, as well as
> 'complete -p' on the first word of new expansion then 'complete ...' on
> the new alias name, so that you copy any completion properties tied to
> the old name over to the new name.
>

hum. I took a look at [1] and understood what you said.

Nice idea, but it doesn't work for some compound aliases (ok, I made this
up. But you'll get it):
http://pastebin.com/khyeFGUS

I got what it happend but I don't know how to solve it.


>
> As long as you define your programmable completions before your aliases
> as part of your ~/.bashrc startup sequence, then this works.
>
> Even better, submit that as an enhancement request to the
> bash-completion project to have bash-completion provide that wrapper
> around alias provided automatically as part of starting up bash-completion.
>

Ok, I'll analyze that betterly. I just got introduced to bash-completion.
Thanks for that.

>
> The answer you sort of wanted:
>
> Yes, it would be nice to patch to bash's completion routines to add an
> opt-in ability to check for programmed completion associated with
> whatever the alias expanded to, and use that when there is no completion
> already associated with the aliased name.  But someone has to write such
> a patch. <http://libvirt.org>
>

That may also be interesting :-)

Have a nice week

references:
[1] http://www.debian-administration.org/articles/316


reply via email to

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