[PATCH v3 0/1] completion: dynamic completion loading

2018-04-29 Thread Florian Gamböck
statement to increase readability (suggested by Junio C Hamano) - Re-worded commit message to include the exakt version of bashcomp that introduced dynamic loading (suggested by Stefan Beller) Florian Gamböck (1): completion: load completion file for external subcommand contrib

[PATCH v3 1/1] completion: load completion file for external subcommand

2018-04-29 Thread Florian Gamböck
mpletion's dynamic loading for git subcommands and make it easier for developers to distribute custom completion scripts. Signed-off-by: Florian Gamböck <m...@floga.de> --- contrib/completion/git-completion.bash | 10 ++ 1 file changed, 10 insertions(+) diff --git a/contrib/completion/git

Re: [PATCH v2 1/1] completion: load completion file for external subcommand

2018-04-29 Thread Florian Gamböck
On 2018-04-29 15:08, SZEDER Gábor wrote: On Sun, Apr 29, 2018 at 1:15 PM, Florian Gamböck <m...@floga.de> wrote: I sense a problem here. If I have a directory with a file xyzfoobar in it, and I type `git xyz`, with no defined subcommand that starts with these letters, then minimal ba

Re: [PATCH v2 1/1] completion: load completion file for external subcommand

2018-04-29 Thread Florian Gamböck
On 2018-04-25 16:40, SZEDER Gábor wrote: In my previous emails I overlooked the _completion_loader() helper function. It seems that this function does almost exactly what we want. It was introduced along with dynamic completion loading back in 20c05b43, so it's available for us even in

Re: [PATCH v2 1/1] completion: load completion file for external subcommand

2018-04-23 Thread Florian Gamböck
On 2018-04-23 17:12, SZEDER Gábor wrote: On Thu, Apr 19, 2018 at 9:07 PM, Florian Gamböck <m...@floga.de> wrote: On 2018-04-18 21:51, SZEDER Gábor wrote: Would it be possible to use _xfunc() instead to plug that hole? It seems the be tricky, because that function not only sources bu

Re: [PATCH v2 1/1] completion: load completion file for external subcommand

2018-04-19 Thread Florian Gamböck
On 2018-04-18 21:51, SZEDER Gábor wrote: On Tue, Apr 10, 2018 at 10:28 PM, Florian Gamböck <m...@floga.de> wrote: Adding external subcommands to Git is as easy as to put an executable file git-foo into PATH. Packaging such subcommands for a Linux distribution can be achieved by unp

[PATCH v2 1/1] completion: load completion file for external subcommand

2018-04-10 Thread Florian Gamböck
script behaves as usual. This way we can leverage bash-completion's dynamic loading for git subcommands and make it easier for developers to distribute custom completion scripts. Signed-off-by: Florian Gamböck <m...@floga.de> --- contrib/completion/git-completion.bash | 10 ++

[PATCH v2 0/1] completion: dynamic completion loading

2018-04-10 Thread Florian Gamböck
. Changes since v1 (RFC): - Re-arranged if-fi statement to increase readability (suggested by Junio C Hamano) - Re-worded commit message to include the exakt version of bashcomp that introduced dynamic loading (suggested by Stefan Beller) Florian Gamböck (1): completion: load completion

Re: [RFC PATCH 1/1] completion: load completion file for external subcommand

2018-04-10 Thread Florian Gamböck
On 2018-04-10 07:06, Junio C Hamano wrote: Florian Gamböck <m...@floga.de> writes: Does my reasoning make sense? Not at all. :-( That actually hurt a bit. But ... I mean, the result will be exactly the same, we are clearly only talking about readability here. ... I agree, and

Re: [RFC PATCH 1/1] completion: Load completion file for external subcommand

2018-04-09 Thread Florian Gamböck
On 2018-04-09 11:26, Stefan Beller wrote: Since bash-completion started to use dynamical loading of completion scripts somewhere around v2.0, it is no longer sufficient to drop a completion script of a subcommand into the standard completions path, /usr/share/bash-completion/completions, since

Re: [RFC PATCH 1/1] completion: load completion file for external subcommand

2018-04-09 Thread Florian Gamböck
On 2018-04-09 18:36, Junio C Hamano wrote: Florian Gamböck <m...@floga.de> writes: > Good point. I could go even further and ditch the if-construct: > >! declare -f $completion_func && declare -f __load_completion && >__load_completion "git-

Re: [RFC PATCH 1/1] completion: load completion file for external subcommand

2018-04-09 Thread Florian Gamböck
On 2018-04-09 07:59, Junio C Hamano wrote: >local completion_func="_git_${command//-/_}" > + if ! declare -f $completion_func >/dev/null 2>/dev/null; then > + declare -f __load_completion >/dev/null 2>/dev/null && > + __load_completion "git-$command" wouldn't the

Re: [RFC PATCH 1/1] completion: Load completion file for external subcommand

2018-04-08 Thread Florian Gamböck
Ah, sorry, please ignore this one.

[RFC PATCH 0/1] completion: Dynamic completion loading

2018-04-08 Thread Florian Gamböck
. Florian Gamböck (1): completion: Load completion file for external subcommand contrib/completion/git-completion.bash | 8 1 file changed, 8 insertions(+) -- 2.16.1

[RFC PATCH 1/1] completion: Load completion file for external subcommand

2018-04-08 Thread Florian Gamböck
behaves as usual. This way we can leverage bash-completion's dynamic loading for git subcommands and make it easier for developers to distribute custom completion scripts. Signed-off-by: Florian Gamböck <m...@floga.de> --- contrib/completion/git-completion.bash | 8 1 file chan

[RFC PATCH 1/1] completion: load completion file for external subcommand

2018-04-08 Thread Florian Gamböck
behaves as usual. This way we can leverage bash-completion's dynamic loading for git subcommands and make it easier for developers to distribute custom completion scripts. Signed-off-by: Florian Gamböck <m...@floga.de> --- contrib/completion/git-completion.bash | 8 1 file chan