Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Extend/Modify/Reuse/Augment existing completion functions



Hello,

I tried to partially override the current git completion for `git commit
--fixup`. My simplistic approach was to create a `_git-commit` file in
my $fpath (before the system path) and then copy the `_git-commit`
function from `Completion/Unix/Command/_git`.

After that I added my own function to generate the completions to `--fixup`:

> __git_commit_tags () {
>   commits=("${(@f)$(git log --pretty=format:'%h:%s')}")
>   _describe 'commits' commits
> }
>
> ..
>     '--fixup=[construct a commit message for use with rebase
--autosquash]:fixup commit:__git_commit_tags' \
> ..

What I don't like is the code duplication. Can I somehow just add my own
completion function for `git commit --fixup` without copying over the
whole thing?

In addition, I've seen that the dev branch already has completion
support for `--fixup`. In case I don't like it when it hits the next
release, is there a way to override just this specific completion?

Thank you very much,

  Jochen

Attachment: signature.asc
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author