# HG changeset patch
# User Steve Losh <steve@stevelosh.com>
# Date 1586619674 14400
# Node ID d34ec597c1f672c67fc24664818a15ad4b30c394
# Parent  831123b0359ff915139c92e534c609fa28fd7bbb# Parent  83fe4c7e8702961806804d0bc9cd94dcf4e3365b
Merge pull request #23 from nfultz/master

simplify exact prefix match

diff -r 831123b0359f -r d34ec597c1f6 t.py
--- 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."""