From f984413e6beb0560a71fff8acb52879f8bd4460c Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Fri, 22 Mar 2024 07:52:12 +0000 Subject: [PATCH] Add tab completion for documented `dlog` alias There's a feature of Git's completion scripts that allows completing function aliases[1]: > If you use complex aliases of form '!f() { ... }; f', you can use the null > command ':' as the first command in the function body to declare the desired > completion style This allows completion: $ git dlog --pat --patch --patch-with-raw --patch-with-stat --patience Tested on `bash`, though I believe this should also work with `zsh` and `tsch` since their respective completion scripts also make use of the `bash` one [1] https://git.kernel.org/pub/scm/git/git.git/tree/contrib/completion/git-completion.bash?id=11c821f2f2a31e70fb5cc449f9a29401c333aad2#n26 --- manual/src/git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/src/git.md b/manual/src/git.md index 8700a3ee6..cca63e1f4 100644 --- a/manual/src/git.md +++ b/manual/src/git.md @@ -71,7 +71,7 @@ equivalent to the one-off commands shown above. ```ini # `git dlog` to show `git log -p` with difftastic. [alias] - dlog = "!f() { GIT_EXTERNAL_DIFF=difft git log -p --ext-diff $@; }; f" + dlog = "!f() { : git log ; GIT_EXTERNAL_DIFF=difft git log -p --ext-diff $@; }; f" ``` ## Difftastic By Default