Fixed use of split() in lookup. Now strips whitespace. #94
[zzz-pokedex.git] / pokedex / __init__.py
index 4af3fa0..6a4ab95 100644 (file)
@@ -15,7 +15,7 @@ def main():
 
     # XXX there must be a better way to get Unicode argv
     # XXX this doesn't work on Windows durp
-    enc = sys.stdin.encoding
+    enc = sys.stdin.encoding or 'utf8'
     args = [_.decode(enc) for _ in args]
 
     # Find the command as a function in this file
@@ -66,8 +66,17 @@ def command_lookup(name):
     else:
         print "Fuzzy-matched:"
 
-    for object, language, exact in results:
-        print object.__tablename__, object.name, language
+    for result in results:
+        if hasattr(result.object, 'full_name'):
+            name = result.object.full_name
+        else:
+            name = result.object.name
+
+        print "%s: %s" % (result.object.__tablename__, name),
+        if result.language:
+            print "(%s in %s)" % (result.name, result.language)
+        else:
+            print
 
 
 def command_help():