mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-23 11:32:20 +03:00
parent
f9b07ea028
commit
5430f6ccad
@ -99,6 +99,14 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-
|
|||||||
) > /dev/null 2>&1 < /dev/null &
|
) > /dev/null 2>&1 < /dev/null &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_git_cmd() {
|
||||||
|
if git "${@}" > /dev/null 2>&1; then
|
||||||
|
printf %s "echo -markup '{Information}git $1 succeeded'"
|
||||||
|
else
|
||||||
|
printf %s "echo -markup '{Error}git $1 failed'"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
update_diff() {
|
update_diff() {
|
||||||
(
|
(
|
||||||
cd_bufdir
|
cd_bufdir
|
||||||
@ -154,7 +162,6 @@ 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
|
||||||
@ -182,44 +189,46 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
show|log|diff|status) show_git_cmd_output "$@" ;;
|
show|log|diff|status)
|
||||||
blame) shift; run_git_blame "$@" ;;
|
show_git_cmd_output "$@"
|
||||||
hide-blame)
|
;;
|
||||||
|
blame)
|
||||||
|
shift
|
||||||
|
run_git_blame "$@"
|
||||||
|
;;
|
||||||
|
hide-blame)
|
||||||
printf %s "try %{
|
printf %s "try %{
|
||||||
set-option buffer=$kak_bufname git_blame_flags $kak_timestamp
|
set-option buffer=$kak_bufname git_blame_flags $kak_timestamp
|
||||||
remove-highlighter window/git-blame
|
remove-highlighter window/git-blame
|
||||||
}"
|
}"
|
||||||
;;
|
;;
|
||||||
show-diff)
|
show-diff)
|
||||||
echo 'try %{ add-highlighter window/git-diff flag-lines Default git_diff_flags }'
|
echo 'try %{ add-highlighter window/git-diff flag-lines Default git_diff_flags }'
|
||||||
update_diff
|
update_diff
|
||||||
;;
|
;;
|
||||||
hide-diff)
|
hide-diff)
|
||||||
echo 'try %{ remove-highlighter window/git-diff }'
|
echo 'try %{ remove-highlighter window/git-diff }'
|
||||||
;;
|
;;
|
||||||
update-diff) update_diff ;;
|
update-diff) update_diff ;;
|
||||||
commit) shift; commit "$@" ;;
|
commit)
|
||||||
init) shift; git init "$@" > /dev/null 2>&1 ;;
|
shift
|
||||||
checkout)
|
commit "$@"
|
||||||
name="${2:-${kak_buffile}}"
|
;;
|
||||||
git checkout "${name}" > /dev/null 2>&1
|
init)
|
||||||
;;
|
shift
|
||||||
add)
|
git init "$@" > /dev/null 2>&1
|
||||||
name="${2:-${kak_buffile}}"
|
;;
|
||||||
if git add -- "${name}" > /dev/null 2>&1; then
|
add|rm)
|
||||||
printf %s "echo -markup '{Information}git: added ${name}'"
|
cmd="$1"
|
||||||
else
|
shift
|
||||||
printf %s "echo -markup '{Error}git: unable to add ${name}'"
|
run_git_cmd $cmd "${@:-${kak_buffile}}"
|
||||||
fi
|
;;
|
||||||
;;
|
reset|checkout)
|
||||||
rm)
|
run_git_cmd "$@"
|
||||||
name="${2:-${kak_buffile}}"
|
;;
|
||||||
if git rm -- "${name}" > /dev/null 2>&1; then
|
*)
|
||||||
printf %s "echo -markup '{Information}git: removed ${name}'"
|
printf %s "echo -markup %{{Error}unknown git command '$1'}"
|
||||||
else
|
exit
|
||||||
printf %s "echo -markup '{Error}git: unable to remove ${name}'"
|
;;
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*) printf %s "echo -markup %{{Error}unknown git command '$1'}"; exit ;;
|
|
||||||
esac
|
esac
|
||||||
}}
|
}}
|
||||||
|
Loading…
Reference in New Issue
Block a user