From 4203badd3a89b2427c8c2b04ecd9b40f942bf3fa Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Tue, 29 Sep 2020 14:47:38 +0000 Subject: [PATCH] add got-clean --- extensions/got.ksh | 18 ++++++++++++++++++ extensions/got.org | 1 + 2 files changed, 19 insertions(+) diff --git a/extensions/got.ksh b/extensions/got.ksh index 254dfee..ec76c7f 100755 --- a/extensions/got.ksh +++ b/extensions/got.ksh @@ -17,6 +17,24 @@ function got-sync { got rebase master } +function got-clean { + local _opt + _opt=$1 + for f in $(got status | grep ^? | awk '{print $2}'); do + case "$_opt" in + -f) + rm -vf "$f" + ;; + -i) + rm -vi "$f" + ;; + *) + echo "rm $f" + ;; + esac + done +} + function got-commit-v { local _width _session _args diff --git a/extensions/got.org b/extensions/got.org index c276e0d..e35406e 100644 --- a/extensions/got.org +++ b/extensions/got.org @@ -4,6 +4,7 @@ This extension adds helper functions to the [[https://gameoftrees.org/][got]] to | Function | Description | |-------------+-------------------------------------------------------------------------| +| ~got-clean~ | Cleans the work directory. | | ~got-push~ | Pushes (~git push~) from the bare repository found in ~.got/repository~ | | ~got-sync~ | Rebase ~master~ on top of ~[remote]/master~. Defaults to ~origin~. | | ~__got_ps1~ | Current got branch. Intended to be used in ~$PS1~. |