summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-28 14:55:34 +0200
committerhut <hut@lavabit.com>2011-10-28 14:55:34 +0200
commitcb0350b010254e0f65fa417475f3ed5484c8f255 (patch)
tree9200035edd222e8157432e020254da3a5631fbf3 /ranger
parentdd06c0e65ecc829281d69206ac7827b83d0da97a (diff)
parent9ab9f65217df8dd75e171702bee2943ca295e956 (diff)
downloadranger-cb0350b010254e0f65fa417475f3ed5484c8f255.tar.gz
Merge branch 'master' of git://github.com/DaPangus/ranger
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/helper.py2
-rw-r--r--ranger/core/main.py7
2 files changed, 9 insertions, 0 deletions
diff --git a/ranger/core/helper.py b/ranger/core/helper.py
index c22a52b8..88072e13 100644
--- a/ranger/core/helper.py
+++ b/ranger/core/helper.py
@@ -66,6 +66,8 @@ def parse_arguments():
 			", it will write the name of the last visited directory to TARGET")
 	parser.add_option('--list-unused-keys', action='store_true',
 			help="List common keys which are not bound to any action.")
+	parser.add_option('--selectfile', type='string', metavar='filepath',
+			help="Open ranger with supplied file selected.")
 
 	options, positional = parser.parse_args()
 	arg = OpenStruct(options.__dict__, targets=positional)
diff --git a/ranger/core/main.py b/ranger/core/main.py
index c87a4660..14e4b1f6 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -49,6 +49,10 @@ def main():
 
 	SettingsAware._setup(clean=arg.clean)
 
+	if arg.selectfile:
+		arg.selectfile = os.path.abspath(arg.selectfile)
+		arg.targets.insert(0, os.path.dirname(arg.selectfile))
+
 	targets = arg.targets or ['.']
 	target = targets[0]
 	if arg.targets:
@@ -97,6 +101,9 @@ def main():
 			from ranger.ext import curses_interrupt_handler
 			curses_interrupt_handler.install_interrupt_handler()
 
+		if arg.selectfile:
+			fm.select_file(arg.selectfile)
+
 		# Run the file manager
 		fm.initialize()
 		fm.ui.initialize()