From 7a4ff77f24e42acce8cf57d41e0c71ea8e026dd0 Mon Sep 17 00:00:00 2001 From: Alasdair Colley Date: Wed, 23 Jul 2014 12:01:35 +0200 Subject: now displays an exact match by default --- saucypy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/saucypy b/saucypy index 5f9c9b7..acc7cab 100755 --- a/saucypy +++ b/saucypy @@ -6,7 +6,7 @@ import optparse import shlex import sys -VERSION = "1.0.0" +VERSION = "1.0.1" ENTRIES_FILE = "saucypy.json" @@ -50,7 +50,10 @@ def main(): matches = find( args[0], entries ) if len( matches ) > 1: - if options.index is not None: + exact_match = filter( lambda x: x == args[0], matches ) + if exact_match: + print entries[exact_match[0]] + elif options.index is not None: try: print entries[matches[options.index]] except IndexError: @@ -65,4 +68,3 @@ def main(): if __name__ == "__main__": main() - -- cgit v1.2.3