commit:     27140082a5c7f0ce57adcddf52681f556ca1fb36
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 29 22:50:36 2017 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Jan  2 22:54:55 2018 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-java.git/commit/?id=27140082

Fix showing and highlighting current ecj and mvn targets (#585224)

 NEWS                         | 1 +
 src/modules/ecj.eselect.in   | 9 +++++----
 src/modules/maven.eselect.in | 9 +++++----
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index a0102aa..c85ba17 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
     * Don't emit (unset) or (not a symlink) on stderr (#549498)
     * Fix mkdir die message in java-vm module
     * Sort java-vm targets in version order rather than alphanumeric
+    * Fix showing and highlighting current ecj + mvn targets (#585224)
 
 0.3.0:
 

diff --git a/src/modules/ecj.eselect.in b/src/modules/ecj.eselect.in
index 7b6d784..353bcc5 100644
--- a/src/modules/ecj.eselect.in
+++ b/src/modules/ecj.eselect.in
@@ -38,8 +38,8 @@ find_target() {
 
 # determine the current target.
 get_target() {
-       local canonicalised=$(canonicalise "${ECJ}")
-       echo $(basename "${canonicalised}")
+       local target=$(readlink "${ECJ}")
+       echo ${target##*/}
 }
 
 ### show action ###
@@ -76,11 +76,12 @@ do_list() {
                die -q "Usage error: no parameters allowed."
        fi
 
-       local i targets
+       local i targets target
        targets=( $(find_targets) )
+       target=$(get_target)
 
        for (( i = 0; i < ${#targets[@]}; i++ )); do
-               [[ ${targets[i]} = $(basename "$(canonicalise "${ECJ}")") ]] \
+               [[ ${targets[i]} = ${target} ]] \
                        && targets[i]=$(highlight_marker "${targets[i]}")
        done
 

diff --git a/src/modules/maven.eselect.in b/src/modules/maven.eselect.in
index f0cf2e4..247fee7 100644
--- a/src/modules/maven.eselect.in
+++ b/src/modules/maven.eselect.in
@@ -41,8 +41,8 @@ remove_symlink() {
 
 # determine the current target.
 get_target() {
-       local canonicalised=$(canonicalise "${MVN}")
-       echo $(basename "${canonicalised}")
+       local target=$(readlink "${MVN}")
+       echo ${target##*/}
 }
 
 # set the Maven symlink.
@@ -86,11 +86,12 @@ do_list() {
                die -q "Usage error: no parameters allowed."
        fi
 
-       local i targets
+       local i targets target
        targets=( $(find_targets) )
+       target=$(get_target)
 
        for (( i = 0; i < ${#targets[@]}; i++ )); do
-               [[ ${targets[i]} = $(basename "$(canonicalise "${MVN}")") ]] \
+               [[ ${targets[i]} = ${target} ]] \
                        && targets[i]=$(highlight_marker "${targets[i]}")
        done
 

Reply via email to