diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-02-26 00:46:09 -0600 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-02-26 00:46:09 -0600 |
commit | fec505240f22065aaea2ee80c1082cad136559bb (patch) | |
tree | c5154ef52e8792b9470957332caeedb925604012 /clean.sh |
Diffstat (limited to 'clean.sh')
-rwxr-xr-x | clean.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..68769e6 --- /dev/null +++ b/clean.sh @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +cd "$(git rev-parse --show-toplevel)" + +if [ "$(git status --porcelain=v1 --ignored -z | grep -z '^!!' | wc -c)" = 0 ]; then + exit +fi + +git status --porcelain=v1 --ignored -z \ +| grep -z '^!!' \ +| xargs -0 awk 'BEGIN { for(i = 1; i < ARGC; i++) printf "%s%c", substr(ARGV[i], 4), 0; }' \ +| xargs -0 rm -r |