summary refs log tree commit diff stats
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
parentaf6658b377d145529e0b9304247ed3b9b6e40856 (diff)
downloadranger-f24e301824daff6cd5513c6931a05bd305ba11e5.tar.gz
commands: forbid to abbreviate :delete with :d (to avoid mistakes)
-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:
02:24:52 +0200 ranger.py: made the argument optional in embedded bash script' href='/akspecs/ranger/commit/ranger.py?h=v1.7.0&id=06848dc3f83e940cf26342a5b6dfeb31c88e1f06'>06848dc3 ^
240394a4 ^
f027adc0 ^
08f08fb9 ^
654af129 ^
08f08fb9 ^
d8084b41 ^

99400080 ^
08f08fb9 ^

654af129 ^

0da832e8 ^
d8084b41 ^
cba63cf3 ^
b4250dbc ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52