diff options
author | Jauhien Piatlicki <jauhien@gentoo.org> | 2014-08-19 13:26:12 +0200 |
---|---|---|
committer | Jauhien Piatlicki <jauhien@gentoo.org> | 2014-08-19 13:26:12 +0200 |
commit | 436dcfa11731bbef6f1f10222b497944cc8e3c4e (patch) | |
tree | 44a34049cf6868fd1184420e9096360f7e9e8649 | |
parent | add update action (diff) | |
download | eselect-rust-436dcfa11731bbef6f1f10222b497944cc8e3c4e.tar.gz eselect-rust-436dcfa11731bbef6f1f10222b497944cc8e3c4e.tar.bz2 eselect-rust-436dcfa11731bbef6f1f10222b497944cc8e3c4e.zip |
add unset action
-rw-r--r-- | src/modules/rust.eselect | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/modules/rust.eselect b/src/modules/rust.eselect index e334e9b..0734798 100644 --- a/src/modules/rust.eselect +++ b/src/modules/rust.eselect @@ -109,21 +109,9 @@ set_symlink() { fi } -# set the rust version - -set_version() { - local target=$1 - - if is_number "${target}"; then - local targets=( $(find_targets) ) - target=${targets[target-1]} - fi - - [[ -z ${target} || ! -x "${EROOT}/usr/bin/rustc-${target}" ]] \ - && die -q "Target \"$1\" doesn't appear to be valid!" - - local datadir="${EROOT}/usr/share/rust-${target}" +# unset the rust version +unset_version() { remove_symlink "${EROOT}"/usr/bin/rustc remove_symlink "${EROOT}"/usr/bin/rustdoc remove_symlink "${EROOT}/${SITELISP}"/rust-mode @@ -138,10 +126,28 @@ set_version() { remove_symlink "${EROOT}/${SITEVIM}/doc/rust.txt" remove_symlink "${EROOT}/${SITEZSH}/_rust" +} + +# set the rust version + +set_version() { + local target=$1 + + if is_number "${target}"; then + local targets=( $(find_targets) ) + target=${targets[target-1]} + fi + + [[ -z ${target} || ! -x "${EROOT}/usr/bin/rustc-${target}" ]] \ + && die -q "Target \"$1\" doesn't appear to be valid!" + + unset_version ln -s "${EROOT}/usr/bin/rustc-${target}" "${EROOT}/usr/bin/rustc" || die -q "rustc symlink setting failed" ln -s "${EROOT}/usr/bin/rustdoc-${target}" "${EROOT}/usr/bin/rustdoc" || die -q "rustdoc symlink setting failed" + local datadir="${EROOT}/usr/share/rust-${target}" + set_symlink "${datadir}/emacs/site-lisp/rust-mode" "${EROOT}/${SITELISP}/rust-mode" && \ set_symlink "${datadir}/emacs/site-lisp/site-gentoo.d/50rust-mode-gentoo.el" \ "${EROOT}/${SITELISP}/site-gentoo.d/50rust-mode-gentoo.el" && \ @@ -232,3 +238,15 @@ do_update() { local targets=( $(find_targets) ) do_set ${#targets[@]} } + +### unset action ### + +describe_unset() { + echo "Unset active rust version" +} + +do_unset() { + [[ $# -gt 0 ]] && die -q "Too many parameters" + + unset_version || die -q "Couldn't unset active version" +} |