From 559711d4ce5af190d57ccfd67ce6d2e95fb545d4 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sat, 28 Mar 2020 09:00:16 +0100 Subject: Bring clean up to date with the rest of the repo --- lib/actions/clean.bash | 32 ++++++++++++++++++++++++++------ lib/main.bash | 5 +++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/lib/actions/clean.bash b/lib/actions/clean.bash index c00e85d..0ed521d 100644 --- a/lib/actions/clean.bash +++ b/lib/actions/clean.bash @@ -1,11 +1,31 @@ #!/usr/bin/env bash action() { - remove "$BASEDIR/tmp" - remove "$BASEDIR/install" -} + local OPTIND + local clean_source + + while getopts ":s" opt + do + case "$opt" in + s) clean_src=1 ;; + *) emerg "Invalid option specified: $opt" ;; + esac + done + + shift $(( OPTIND - 1 )) + + shopt -s extglob + + rm -fr -- "!($BASEDIR/bin/rstar)" + rm -fr -- "$BASEDIR/dist" + rm -fr -- "$BASEDIR/include" + rm -fr -- "$BASEDIR/lib/libmoar.so" + rm -fr -- "$BASEDIR/share" -remove() { - info "Removing $1" - rm -fr -- "$1" + # Cleaning the sources is not desired for end-users, but convenient for + # maintainers. As such, this one is put behind an opt. + if [[ $clean_src ]] + then + rm -fr -- "$BASEDIR/src" + fi } diff --git a/lib/main.bash b/lib/main.bash index 18d5dfd..a06c003 100644 --- a/lib/main.bash +++ b/lib/main.bash @@ -74,7 +74,7 @@ usage() { cat <