summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Bengoa <david@bengoarocandio.com>2012-02-12 16:41:48 +0100
committerDavid Bengoa <david@bengoarocandio.com>2012-02-12 16:41:48 +0100
commita0cff8b77b3a81c84661e96a1efdd5bd5d6e6eac (patch)
treec6a0b0ae76773a4c591c852bb129c6ca6c514273
parent5eed34cb880330cae45c6cfedad596a4c74700e5 (diff)
downloadranger-a0cff8b77b3a81c84661e96a1efdd5bd5d6e6eac.tar.gz
Add --cmd=COMMAND command line option
-rw-r--r--ranger/core/helper.py2
-rw-r--r--ranger/core/main.py4
2 files changed, 6 insertions, 0 deletions
diff --git a/ranger/core/helper.py b/ranger/core/helper.py
index 446d9328..3f93e79c 100644
--- a/ranger/core/helper.py
+++ b/ranger/core/helper.py
@@ -73,6 +73,8 @@ def parse_arguments():
 			help="List all files which are tagged with the given tag, default: *")
 	parser.add_option('--profile', action='store_true',
 			help="Print statistics of CPU usage on exit.")
+	parser.add_option('--cmd', type='string', metavar='COMMAND',
+			help="COMMAND will be executed after ranger has initialized")
 
 	options, positional = parser.parse_args()
 	arg = OpenStruct(options.__dict__, targets=positional)
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 8458f928..f80ee2d6 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -121,6 +121,10 @@ def main():
 		# Run the file manager
 		fm.initialize()
 		fm.ui.initialize()
+
+		if arg.cmd:
+			fm.execute_console(arg.cmd)
+
 		if ranger.arg.profile:
 			import cProfile
 			import pstats