summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-13 22:52:45 +0100
committerhut <hut@lavabit.com>2010-01-13 22:52:45 +0100
commitd8ea8d5fff1c0973a1c361672565b915d81bf774 (patch)
tree26e948421b8894ebfec919b3998de22b667ee33f /ranger
parentbc37a599decaba366327798a4c888d007590eafa (diff)
downloadranger-d8ea8d5fff1c0973a1c361672565b915d81bf774.tar.gz
commandlist: added alias(existing, *new)
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/commandlist.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ranger/container/commandlist.py b/ranger/container/commandlist.py
index 2ba22ef7..e66871ea 100644
--- a/ranger/container/commandlist.py
+++ b/ranger/container/commandlist.py
@@ -126,6 +126,17 @@ class CommandList(object):
 		self.commandlist.append(obj)
 		for key in obj.keys:
 			self.paths[key] = obj
+	
+	def alias(self, existing, *new):
+		"""bind the <new> keys to the command of the <existing> key"""
+		existing = self._str_to_tuple(existing)
+		new = tuple(map(self._str_to_tuple, new))
+
+		cmd = self.paths[existing]
+
+		for key in new:
+			self.paths[key] = cmd
+			cmd.keys |= set([key])
 
 	def unbind(self, *keys):
 		i = len(self.commandlist)