summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/rust.eselect21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/modules/rust.eselect b/src/modules/rust.eselect
index 5e11223..5f1a576 100644
--- a/src/modules/rust.eselect
+++ b/src/modules/rust.eselect
@@ -245,8 +245,27 @@ describe_unset() {
echo "Unset active rust version"
}
+describe_update_options() {
+ echo "--if-invalid : Unset only if symlink is invalid (e.g. package was uninstalled)"
+}
+
do_unset() {
- [[ $# -gt 0 ]] && die -q "Too many parameters"
+ local if_invalid="0"
+ while [[ $# > 0 ]]; do
+ case "$1" in
+ --if-invalid)
+ if_invalid="1"
+ ;;
+ *)
+ die -q "Unrecognized argument '$1'"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${if_invalid}" == "1" && -e "${EROOT}"/usr/bin/rustc ]]; then
+ return
+ fi
unset_version || die -q "Couldn't unset active version"
}