about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-09-24 00:13:59 +0200
committerhut <hut@lavabit.com>2011-09-24 00:13:59 +0200
commitf491d57798601093c1ee353aa9943e995a1e5648 (patch)
tree992750ca3e930ca2721763075175ab64a496121b /ranger
parent01f0ff6016f71dade2ad8a538060e66c5ef7ae12 (diff)
downloadranger-f491d57798601093c1ee353aa9943e995a1e5648.tar.gz
core.actions: Added flag "c" + documentation
The "c" flag allows you to run the current file even though
other files are marked.  Will only work when using fm.execute_file.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/actions.py7
-rw-r--r--ranger/core/runner.py2
-rw-r--r--ranger/help/starting.py1
3 files changed, 9 insertions, 1 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index d77f2a86..c8dffa55 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -163,6 +163,13 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		elif type(files) not in (list, tuple):
 			files = [files]
 
+		if 'flags' in kw:
+			from ranger.core.runner import Context
+			context = Context(files=list(files), flags=kw['flags'])
+			context.squash_flags()
+			if 'c' in context.flags:
+				files = [self.fm.env.cf]
+
 		self.signal_emit('execute.before', keywords=kw)
 		try:
 			return self.run(files=list(files), **kw)
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index dd0cf06a..53bede29 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -37,7 +37,7 @@ from subprocess import Popen, PIPE
 from ranger.ext.waitpid_no_intr import waitpid_no_intr
 
 
-ALLOWED_FLAGS = 'sdpwSDPW'
+ALLOWED_FLAGS = 'sdpwcSDPWC'
 
 
 def press_enter():
diff --git a/ranger/help/starting.py b/ranger/help/starting.py
index 1796f83d..dbc6b6b5 100644
--- a/ranger/help/starting.py
+++ b/ranger/help/starting.py
@@ -103,6 +103,7 @@ Flags give you a way to modify the behaviour of the spawned process.
 	d	Detach the process.  (Run in background)
 	p	Redirect output to the pager
 	w	Wait for an enter-press when the process is done
+	c	Run the current file only, even when more files are marked
 
 For example, ":open_with p" will pipe the output of that process into
 the pager.