git/contrib/completion
Steffen Prohaska 56f24e80f0 completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliases
'!f() { ... }; f' and "!sh -c '....' -" are recommended patterns for
declaring more complex aliases (see git wiki [1]).  This commit teaches
the completion to handle them.

When determining which completion to use for an alias, an opening brace
or single quote is now skipped, and the search for a git command is
continued.  For example, the aliases '!f() { git commit ... }' or "!sh
-c 'git commit ...'" now trigger commit completion.  Previously, the
search stopped on the opening brace or quote, and the completion tried
it to determine how to complete, which obviously was useless.

The null command ':' is now skipped, so that it can be used as
a workaround to declare the desired completion style.

For example, the aliases

    !f() { : git commit ; if ... } f
    !sh -c ': git commit; if ...' -

now trigger commit completion.

Shell function declarations now work with or without space before
the parens, i.e. '!f() ...' and '!f () ...' both work.

[1] https://git.wiki.kernel.org/index.php/Aliases

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-13 13:37:43 -07:00
..
git-completion.bash completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliases 2014-06-13 13:37:43 -07:00
git-completion.tcsh remove #!interpreter line from shell libraries 2013-11-26 14:23:56 -08:00
git-completion.zsh completion: fix completing args of aliased "push", "fetch", etc. 2014-04-09 14:22:18 -07:00
git-prompt.sh Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname' 2014-05-19 16:10:10 -07:00