Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

A bit painful, but quite nice output

  • Loading branch information...
commit 7d706c8f35a0f0115b87ed6d1e0fe50f6429c453 1 parent 5b167ce
Etienne Kneuss authored September 03, 2012
40  src/main/scala/bibimbap/modules/ResultStore.scala
@@ -81,16 +81,40 @@ class ResultStore(val repl: ActorRef, val console: ActorRef, val settings: Setti
81 81
   }
82 82
 
83 83
   private def displayResults() {
  84
+    var displayLegend = Map(
  85
+      "alternatives" -> false,
  86
+      "managed"      -> false,
  87
+      "managedMod"   -> false,
  88
+      "managedInv"   -> false,
  89
+      "incomplete"   -> false
  90
+    )
  91
+
84 92
     var i = 0
85 93
     for (res <- results) {
86 94
       val spc = if ((i < 10) && (results.size > 10)) " " else ""
87 95
 
  96
+      val sources = if (res.alternatives.isEmpty) {
  97
+        " "
  98
+      } else {
  99
+        displayLegend += "alternatives" -> true
  100
+        "\u2026"
  101
+      }
  102
+
88 103
       val symbol = if (res.isManaged) {
89  
-        "\u2713"
  104
+        if (!res.entry.isValid) {
  105
+          displayLegend += "managedInv" -> true
  106
+        } else if(res.isEdited) {
  107
+          displayLegend += "managedMod" -> true
  108
+        } else {
  109
+          displayLegend += "managed"    -> true
  110
+        }
  111
+
  112
+        "\u2714"
90 113
       } else if (res.entry.isValid) {
91 114
         " "
92 115
       } else {
93  
-        "?"
  116
+        displayLegend += "incomplete"   -> true
  117
+        "\u2049"
94 118
       }
95 119
 
96 120
       val color = if (res.entry.isValid) {
@@ -109,9 +133,19 @@ class ResultStore(val repl: ActorRef, val console: ActorRef, val settings: Setti
109 133
         symbol
110 134
       }
111 135
 
112  
-      console ! Info(status+" "+spc+"["+i+"] "+res.entry.inlineString)
  136
+      console ! Out(" "+sources+status+" "+spc+"["+i+"] "+res.entry.inlineString)
113 137
       i += 1
114 138
     }
  139
+
  140
+    if (displayLegend.exists(_._2 == true)) {
  141
+      console ! Out("")
  142
+      console ! Out(" Legend:")
  143
+      if (displayLegend("alternatives")) console ! Out("   "+Console.BOLD+"\u2026"+Console.RESET+" : Alternatives available")
  144
+      if (displayLegend("managed"))      console ! Out("   "+Console.BOLD+Console.GREEN +"\u2714"+Console.RESET+" : Managed")
  145
+      if (displayLegend("managedMod"))   console ! Out("   "+Console.BOLD+Console.YELLOW+"\u2714"+Console.RESET+" : Managed (edited)")
  146
+      if (displayLegend("managedInv"))   console ! Out("   "+Console.BOLD+Console.YELLOW+"\u2714"+Console.RESET+" : Managed (incomplete)")
  147
+      if (displayLegend("incomplete"))   console ! Out("   "+Console.BOLD+Console.RED +"\u2049"+Console.RESET  +" : Incomplete")
  148
+    }
115 149
     if (results.isEmpty) {
116 150
       console ! Info("No match")
117 151
     }

0 notes on commit 7d706c8

Please sign in to comment.
Something went wrong with that request. Please try again.