diff options
author | EuAndreh <eu@euandre.org> | 2023-12-08 18:27:09 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-12-08 18:27:09 -0300 |
commit | 3ab4e41230d8e3ff64e5cb3054c5185945615dd6 (patch) | |
tree | b9131a3dcbb22b5eb159173e32691e5d2542d271 | |
parent | etc/guix/home.scm: Fix imports (diff) | |
download | dotfiles-3ab4e41230d8e3ff64e5cb3054c5185945615dd6.tar.gz dotfiles-3ab4e41230d8e3ff64e5cb3054c5185945615dd6.tar.xz |
etc/sh/rc: Replace "clean" alias with clean(1) utility
-rwxr-xr-x | bin/clean | 70 | ||||
-rwxr-xr-x | bin/vcs | 4 | ||||
-rw-r--r-- | etc/sh/rc | 1 |
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 @@ -165,6 +165,10 @@ git_ls() { git ls-files } +git_clean() { + git clean -nffdx +} + usage() { cat <<-'EOF' @@ -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`' |