Merge pull request #23 from nfultz/master
simplify exact prefix match
    
        | author | Steve Losh <steve@stevelosh.com> | 
    
        | date | Sat, 11 Apr 2020 11:41:14 -0400 | 
    
    
        | parents | 831123b0359f 
(current diff)
83fe4c7e8702 
(diff) | 
    
        | children | 89ad444c000b | 
    
        | branches/tags | (none) | 
    
        | files | t.py | 
Changes
    
--- a/t.py	Sat Apr 11 11:39:16 2020 -0400
+++ b/t.py	Sat Apr 11 11:41:14 2020 -0400
@@ -165,12 +165,10 @@
             return self.tasks[matched[0]]
         elif len(matched) == 0:
             raise UnknownPrefix(prefix)
+        elif prefix in matched:
+            return self.tasks[prefix]
         else:
-            matched = [tid for tid in self.tasks.keys() if tid == prefix]
-            if len(matched) == 1:
-                return self.tasks[matched[0]]
-            else:
-                raise AmbiguousPrefix(prefix)
+            raise AmbiguousPrefix(prefix)
 
     def add_task(self, text, verbose, quiet):
         """Add a new, unfinished task with the given summary text."""