diff options
| author | Hannu Hartikainen <hannu.hartikainen@gmail.com> | 2020-03-29 19:42:49 +0300 |
|---|---|---|
| committer | Hannu Hartikainen <hannu.hartikainen@gmail.com> | 2020-04-08 15:53:05 +0300 |
| commit | bb376aee802b722fef7dbe5a94dcd00f873fc76c (patch) | |
| tree | bda0f5bd27dd846e20b0b94b7c70aff7a4acf77e /src | |
| parent | Merge pull request #695 from syohex/syohex/dget-complete-also-package (diff) | |
| download | zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.tar zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.tar.gz zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.tar.bz2 zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.tar.lz zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.tar.xz zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.tar.zst zsh-completions-bb376aee802b722fef7dbe5a94dcd00f873fc76c.zip | |
Add completion for git-revise
Diffstat (limited to 'src')
| -rw-r--r-- | src/_git-revise | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/_git-revise b/src/_git-revise new file mode 100644 index 0000000..7e7c1f0 --- /dev/null +++ b/src/_git-revise @@ -0,0 +1,52 @@ +#compdef git-revise +#description update, split and rearrange commits +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for git-revise 0.5.1 +# (https://github.com/mystor/git-revise/). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Hannu Hartikainen (https://github.com/dancek) +# +# ------------------------------------------------------------------------------ + +__git-revise_commits() { + local -a commits + commits=(${(f)"$(git log -20 --pretty=format:'%h:%d %s' | sed 's/: /:/')"}) + _describe -V 'commit' commits +} + +__git-revise_branches() { + local -a branches + branches=(${(f)"$(git for-each-ref --format='%(refname:short)' refs/heads/)"}) + _describe 'branch' branches +} + +_git-revise() { + local curcontext="$curcontext" ret=1 + + _arguments -s \ + '(- :)'{-h,--help}'[show help message and exit]' \ + '--ref=[reference to update]: :__git-revise_branches' \ + '--reauthor[reset the author of the targeted commit]' \ + '(- :)--version[show version number and exit]' \ + '(--edit -e)'{--edit,-e}'[edit commit message of targeted commit(s)]' \ + '(--no-autosquash)--autosquash[automatically apply fixup! and squash! commits to their targets]' \ + '(--autosquash)--no-autosquash[force disable revise.autoSquash behaviour]' \ + '(--all -a)--no-index[ignore the index while rewriting history]' \ + '(--no-index --all -a)'{--all,-a}'[stage all tracked files before running]' \ + '(--interactive -i --message -m --cut -c)'{--interactive,-i}'[interactively edit commit stack]' \ + '(--interactive -i --message -m --cut -c)'{--message,-m}'[specify commit message on command line]:MESSAGE:()' \ + '(--interactive -i --message -m --cut -c)'{--cut,-c}'[interactively cut a commit into two smaller commits]' \ + '1: :__git-revise_commits' && ret=0 + + return $ret +} + +_git-revise "$@" + |
