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
>162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310