about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/api/commands.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 73975adc..ca3f730d 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -48,13 +48,14 @@ class CommandContainer(object):
 	def get_command(self, name, abbrev=True):
 		if abbrev:
 			lst = [cls for cmd, cls in self.commands.items() \
-					if cmd.startswith(name) \
-					and cls.allow_abbrev \
+					if cls.allow_abbrev and cmd.startswith(name) \
 					or cmd == name]
 			if len(lst) == 0:
 				raise KeyError
-			if len(lst) == 1 or self.commands[name] in lst:
+			if len(lst) == 1:
 				return lst[0]
+			if self.commands[name] in lst:
+				return self.commands[name]
 			raise ValueError("Ambiguous command")
 		else:
 			try: