about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--ranger/__main__.py18
2 files changed, 12 insertions, 8 deletions
diff --git a/TODO b/TODO
index 69f2c1dd..9d50d75f 100644
--- a/TODO
+++ b/TODO
@@ -21,7 +21,7 @@ General
    (X) #15  09/12/29  better way of running processes!!~
    (X) #16  10/01/01  list of bookmarks
    (X) #21  10/01/01  write help!
-   ( ) #22  10/01/03  add getopt options to change flags/mode
+   (X) #22  10/01/03  add getopt options to change flags/mode
    (X) #29  10/01/06  add chmod command
    (X) #30  10/01/06  add a way to create symlinks
    ( ) #32  10/01/08  place the (hidden) cursor to a meaningful position
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