summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-19 21:23:02 +0100
committerhut <hut@lavabit.com>2010-01-19 21:23:02 +0100
commitf24e301824daff6cd5513c6931a05bd305ba11e5 (patch)
treedec79336cb74788273575a44e67d72e05f9e8dad /ranger
parentaf6658b377d145529e0b9304247ed3b9b6e40856 (diff)
downloadranger-f24e301824daff6cd5513c6931a05bd305ba11e5.tar.gz
commands: forbid to abbreviate :delete with :d (to avoid mistakes)
Diffstat (limited to 'ranger')
-rw-r--r--ranger/commands.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ranger/commands.py b/ranger/commands.py
index 0cfe78b6..a4074075 100644
--- a/ranger/commands.py
+++ b/ranger/commands.py
@@ -20,6 +20,7 @@ from ranger.ext.command_parser import LazyParser as parse
 class Command(FileManagerAware):
 	"""Abstract command class"""
 	name = None
+	allow_abbrev = True
 	def __init__(self, line, mode):
 		self.line = line
 		self.mode = mode
@@ -251,6 +252,8 @@ class delete(Command):
 	use the "current file" (where the cursor is)
 	"""
 
+	allow_abbrev = False
+
 	def execute(self):
 		self.fm.delete()
 
@@ -410,7 +413,9 @@ def alias(**kw):
 
 def get_command(name, abbrev=True):
 	if abbrev:
-		lst = [cls for cmd, cls in by_name.items() if cmd.startswith(name)]
+		lst = [cls for cmd, cls in by_name.items() \
+				if cmd.startswith(name) \
+				and cls.allow_abbrev]
 		if len(lst) == 0:
 			raise KeyError
 		if len(lst) == 1: