aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/clean70
-rwxr-xr-xbin/vcs4
-rw-r--r--etc/sh/rc1
3 files changed, 74 insertions, 1 deletions
diff --git a/bin/clean b/bin/clean
new file mode 100755
index 0000000..889af8d
--- /dev/null
+++ b/bin/clean
@@ -0,0 +1,70 @@
+#!/bin/sh
+set -eu
+
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ clean
+ clean -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+
+
+ Options:
+ -h, --help show this message
+
+
+ Clean the project and list the leftover files.
+
+
+ Examples:
+
+ Just run it:
+
+ $ clean
+ EOF
+}
+
+
+for flag in "$@"; do
+ case "$flag" in
+ (--)
+ break
+ ;;
+ (--help)
+ usage
+ help
+ exit
+ ;;
+ (*)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ (h)
+ usage
+ help
+ exit
+ ;;
+ (*)
+ usage >&2
+ exit 2
+ esac
+done
+shift $((OPTIND - 1))
+
+
+if [ -e dev.mk ]; then
+ F='Makefile'
+else
+ F='dev.mk'
+fi
+
+make -sf"$F" clean
+vcs clean
diff --git a/bin/vcs b/bin/vcs
index 7c9bce6..b51cf33 100755
--- a/bin/vcs
+++ b/bin/vcs
@@ -165,6 +165,10 @@ git_ls() {
git ls-files
}
+git_clean() {
+ git clean -nffdx
+}
+
usage() {
cat <<-'EOF'
diff --git a/etc/sh/rc b/etc/sh/rc
index 2c8e93c..8abef18 100644
--- a/etc/sh/rc
+++ b/etc/sh/rc
@@ -211,7 +211,6 @@ alias info='info --init-file "$XDG_CONFIG_HOME"/info/infokey'
alias wget='wget --hsts-file="$XDG_STATE_HOME"/wget-hsts'
alias tmux='tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf'
-alias clean='make -s clean && git clean -nffdx'
alias flush='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null'
alias kal='khal calendar today `LANG=en.UTF-8 date +%A`'