Re: [PATCH 1/4] bash: improve aliased command recognition

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

 



SZEDER Gábor <szeder@xxxxxxxxxx> writes:

> [alias]
>     lgm = "!sh -c 'GIT_NOTES_REF=refs/notes/amlog git log \"$@\" || :' -"
>
> The full parsing of a shell command alias like that in the completion
> code is clearly unfeasible.  However, we can easily improve on aliased
> command recognition by eleminating stuff that is definitely not a git
> command: shell commands (anything starting with '!'), command line
> options (anything starting with '-'), environment variables (anything
> with a '=' in it), and git itself.  This way the above alias would be
> handled correctly, and the completion script would correctly recognize
> "log" as the aliased git command.

I personally do not think such a heuristic is worth the trouble (both for
writing and maintaining the completion code nor runtime overhead to
iterate over words on the expansion).

I vaguely recall somebody floated an idea to tell completion code that
"you may not know what lgm is, but it takes the same set of options as
log" (either via config or a shell function---I don't recall the details).
I think that would be a lot more robust, efficient and easy to explain
solution to the same problem.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]