1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
# (C) 2011-2012 magicant
# Completion script for the "git-commit" command.
# Supports Git 1.7.7.
function completion/git-commit {
WORDS=(git commit "${WORDS[2,-1]}")
command -f completion//reexecute
}
function completion/git::commit:arg {
OPTIONS=( #>#
"a --all; include modified or deleted files that have not been added"
"--allow-empty; allow a commit that makes no change"
"--allow-empty-message"
"--amend; redo the last commit on the current branch"
"--author:; specify the author"
"--cleanup:; specify the way the message is cleaned up"
"--date:; specify the date"
"--dry-run; don't actually commit, but show what would happen"
"e --edit; reedit the message"
"F: --file:; specify a file containing the message"
"--fixup:; prepare the message to fix up the specified commit in later autosquash"
"i --include; include operand files in the commit"
"m: --message:; specify the message"
"--no-edit; don't reedit the message"
"--no-status; don't include file statuses in the message template"
"n --no-verify; bypass the pre-commit and commit-msg hooks"
"o --only; commit operand files only"
"p --patch; interactive choose patch hunks to commit"
"--porcelain; dry-run with the machine-friendly format"
"q --quiet; suppress the commit summary message"
"--reset-author; ignore the date and author of the original commit"
"C: --reuse-message:; specify an existing commit from which the message is reused"
"c: --reedit-message:; like -C, but reedit the message"
"--short; dry-run with a short output format"
"s --signoff; add a \"signed-off-by\" line to the message"
"--squash:; prepare the message to squash the specified commit in later autosquash"
"--status; include file statuses in the message template"
"t: --template:; specify a file containing a template message to edit"
"u:: --untracked-files::; print untracked files"
"v --verbose; include diffs in the message template"
"z; print a null byte after each filename"
) #<#
command -f completion//parseoptions -n
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
(--author)
command -f completion/git::--author:arg
;;
(--cleanup) #>>#
complete -P "$PREFIX" -D "like \"strip\" when editing and \"whitespace\" otherwise" default
complete -P "$PREFIX" -D "delete empty lines and comments" strip
complete -P "$PREFIX" -D "don't clean up the message at all" verbatim
complete -P "$PREFIX" -D "delete empty lines" whitespace
;; #<<#
# (--date)
# TODO complete date
# ;;
([Ft]|--file|--template)
complete -P "$PREFIX" -f
;;
([Cc]|--fixup|--reuse-message|--reedit-message|--squash)
command -f completion/git::completeref
;;
(u|--untracked-files)
command -f completion/git::--untracked-files:arg
;;
('')
command -f completion/git::completefilteredpath
;;
esac
}
# vim: set ft=sh ts=8 sts=8 sw=8 noet:
|