summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-05-23 10:56:52 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-05-23 10:56:52 +0100
commitccfb87ecf39592b2cf4fa00cdbd53098594c26f2 (patch)
tree48162edb6f00fafb4653430bd7a8ad5923dd2cb4
parentdd25dcc36185a890194d09e4d0430567e76bf722 (diff)
git-tools: support git rm and avoid interpreting git output
-rw-r--r--rc/git-tools.kak16
1 files changed, 12 insertions, 4 deletions
diff --git a/rc/git-tools.kak b/rc/git-tools.kak
index 18b49801..57c6072d 100644
--- a/rc/git-tools.kak
+++ b/rc/git-tools.kak
@@ -23,12 +23,12 @@ decl line-flag-list git_blame_flags
decl line-flag-list git_diff_flags
def -shell-params \
- -docstring %sh{printf "%%{git wrapping helper\navailable commands:\n add\n blame\n commit\n checkout\n diff\n hide-blame\n log\n show\n show-diff\n status\n update-diff}"} \
+ -docstring %sh{printf "%%{git wrapping helper\navailable commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n log\n show\n show-diff\n status\n update-diff}"} \
-shell-completion %{
shift $(expr ${kak_token_to_complete})
prefix=${1:0:${kak_pos_in_token}}
(
- for cmd in add blame commit checkout diff hide-blame log show show-diff status update-diff; do
+ for cmd in add rm blame commit checkout diff hide-blame log show show-diff status update-diff; do
expr "${cmd}" : "^\(${prefix}.*\)$"
done
) | grep -v '^$'
@@ -157,16 +157,24 @@ def -shell-params \
commit) shift; commit "$@" ;;
checkout)
name="${2:-${kak_buffile}}"
- git checkout "${name}"
+ git checkout "${name}" > /dev/null 2>&1
;;
add)
name="${2:-${kak_buffile}}"
- if git add -- "${name}"; then
+ if git add -- "${name}" > /dev/null 2>&1; then
echo "echo -color Information 'git: added ${name}'"
else
echo "echo -color Error 'git: unable to add ${name}'"
fi
;;
+ rm)
+ name="${2:-${kak_buffile}}"
+ if git rm -- "${name}" > /dev/null 2>&1; then
+ echo "echo -color Information 'git: removed ${name}'"
+ else
+ echo "echo -color Error 'git: unable to remove ${name}'"
+ fi
+ ;;
*) echo "echo -color Error %{unknown git command '$1'}"; exit ;;
esac
}}