summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-14 01:32:49 +0100
committerhut <hut@lavabit.com>2010-01-14 01:32:49 +0100
commit757e1f5562709d3a625ea9258a3602502577d324 (patch)
treee84635556adcb72dff83d8aa75f2b05b15ee98e0 /ranger
parentacd07c4abfbc15252d28c884c2bea6d67910a465 (diff)
downloadranger-757e1f5562709d3a625ea9258a3602502577d324.tar.gz
main: allow to set flags/mode for directly started files
Diffstat (limited to 'ranger')
-rw-r--r--ranger/__main__.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 24cf62c1..c34aa976 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -48,16 +48,20 @@ def main():
 
 
 	# Parse options
-	parser = OptionParser( usage = USAGE,
-			version = 'ranger ' + __version__ )
+	parser = OptionParser(usage=USAGE, version='ranger ' + __version__)
 
 	# Instead of using this directly, use the embedded
 	# shell script by running ranger with:
 	# source /path/to/ranger /path/to/ranger
-	parser.add_option( '--cd-after-exit',
-			action = 'store_true',
-			dest = 'cd_after_exit',
-			help = SUPPRESS_HELP )
+	parser.add_option('--cd-after-exit',
+			action='store_true',
+			help=SUPPRESS_HELP)
+
+	parser.add_option('-m', type='int', dest='mode', default=0,
+			help="if a filename is supplied, run it with this mode")
+
+	parser.add_option('-f', type='string', dest='flags', default='',
+			help="if a filename is supplied, run it with these flags.")
 
 	args, rest = parser.parse_args()
 
@@ -74,7 +78,7 @@ def main():
 			sys.exit(1)
 		elif os.path.isfile(target):
 			thefile = File(target)
-			FM().execute_file(thefile)
+			FM().execute_file(thefile, mode=args.mode, flags=args.flags)
 			sys.exit(0)
 		else:
 			path = target