aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/actions/clean.bash32
-rw-r--r--lib/main.bash5
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 <<EOF
Usage:
rstar -h
- rstar clean
+ rstar clean [-s]
rstar dist [version]
rstar fetch
rstar install [-b backend] [-p prefix] [core] [modules]
@@ -84,7 +84,8 @@ Usage:
rstar is the entry point for all utilities to deal with Rakudo Star.
Actions:
- clean Clean up the repository.
+ clean Clean up the repository. If -s is given, the src directory
+ will also be removed.
dist Create a distributable tarball of this repository. If no
version identifier is specified, it will use the current year
and month in "yyyy.mm" notation.