This commit is contained in:
Maxime Coste 2019-04-29 09:30:31 +04:00
commit 92972bed4f

View File

@ -25,10 +25,10 @@ declare-option -hidden line-specs git_diff_flags
define-command -params 1.. \ define-command -params 1.. \
-docstring %sh{printf 'git [<arguments>]: git wrapping helper -docstring %sh{printf 'git [<arguments>]: git wrapping helper
All the optional arguments are forwarded to the git utility All the optional arguments are forwarded to the git utility
Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n hide-diff\n log\n show\n show-diff\n status\n update-diff'} \ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n hide-diff\n \init\n log\n show\n show-diff\n status\n update-diff'} \
-shell-script-candidates %{ -shell-script-candidates %{
if [ $kak_token_to_complete -eq 0 ]; then if [ $kak_token_to_complete -eq 0 ]; then
printf "add\nrm\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nshow\nshow-diff\nstatus\nupdate-diff\n" printf "add\nrm\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nshow\nshow-diff\ninit\nstatus\nupdate-diff\n"
else else
case "$1" in case "$1" in
commit) printf -- "--amend\n--no-edit\n--all\n--reset-author\n--fixup\n--squash\n"; git ls-files -m ;; commit) printf -- "--amend\n--no-edit\n--all\n--reset-author\n--fixup\n--squash\n"; git ls-files -m ;;
@ -145,6 +145,7 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-
' '
} }
commit() { commit() {
# Handle case where message needs not to be edited # Handle case where message needs not to be edited
if grep -E -q -e "-m|-F|-C|--message=.*|--file=.*|--reuse-message=.*|--no-edit|--fixup.*|--squash.*"; then if grep -E -q -e "-m|-F|-C|--message=.*|--file=.*|--reuse-message=.*|--no-edit|--fixup.*|--squash.*"; then
@ -189,6 +190,7 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-
;; ;;
update-diff) update_diff ;; update-diff) update_diff ;;
commit) shift; commit "$@" ;; commit) shift; commit "$@" ;;
init) shift; git init "$@" > /dev/null 2>&1 ;;
checkout) checkout)
name="${2:-${kak_buffile}}" name="${2:-${kak_buffile}}"
git checkout "${name}" > /dev/null 2>&1 git checkout "${name}" > /dev/null 2>&1