about summary refs log tree commit diff stats
path: root/ranger/actions.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-29 21:27:46 +0100
committerhut <hut@lavabit.com>2009-12-29 21:27:46 +0100
commit5715becad1ecc186408883518fa516392ebf6d55 (patch)
tree3de750d52f336cf9cc0f1b1dfa07a2acd30c2ed0 /ranger/actions.py
parent836e9eae3bf074ec1f3db808b23526cdca7b1323 (diff)
downloadranger-5715becad1ecc186408883518fa516392ebf6d55.tar.gz
F1 key (inside console) for viewing information about the command
Diffstat (limited to 'ranger/actions.py')
-rw-r--r--ranger/actions.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/ranger/actions.py b/ranger/actions.py
index 3aef7d86..d85184a3 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -152,6 +152,28 @@ class Actions(EnvironmentAware, SettingsAware):
 		"""Handle mouse-buttons if one was pressed"""
 		self.ui.handle_mouse()
 	
+	def display_command_help(self, console_widget):
+		if not hasattr(self.ui, 'open_pager'):
+			return
+
+		try:
+			command = console_widget._get_cmd_class()
+		except:
+			self.notify("Feature not available!", bad=True)
+			return
+
+		if not command:
+			self.notify("Command not found!", bad=True)
+			return
+
+		if not command.__doc__:
+			self.notify("Command has no docstring. Try using python without -OO",
+					bad=True)
+			return
+
+		pager = self.ui.open_pager()
+		pager.set_source(command.__doc__.strip(), strip=True)
+	
 	def display_file(self):
 		if not hasattr(self.ui, 'open_embedded_pager'):
 			return