summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-26 13:32:40 +0200
committerhut <hut@lavabit.com>2010-04-26 20:57:40 +0200
commit83868c7aa8ca35d9d0c1606dd62b44e97bd7e356 (patch)
tree60ba5092dfa274632f5c6da3d45b758bcb6386ce /ranger
parentf3bc52e556867d00fa1ba51f9dc93a2cde75b15b (diff)
downloadranger-83868c7aa8ca35d9d0c1606dd62b44e97bd7e356.tar.gz
Fixed bug #65 by adding flag "--fail-if-run"
Diffstat (limited to 'ranger')
-rw-r--r--ranger/__main__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 0814565f..8bb0bfa1 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -45,6 +45,9 @@ def parse_arguments():
 			help="activate debug mode")
 	parser.add_option('-c', '--clean', action='store_true',
 			help="don't touch/require any config files. ")
+	parser.add_option('--fail-if-run', action='store_true',
+			help="experimental: return the exit code 1 if ranger is" \
+					"used to run a file (with `ranger filename`)")
 	parser.add_option('-r', '--confdir', type='string',
 			metavar='dir', default=DEFAULT_CONFDIR,
 			help="the configuration directory. (%default)")
@@ -178,7 +181,7 @@ def main():
 			runner = Runner(logfunc=print_function)
 			load_apps(runner, ranger.arg.clean)
 			runner(files=[File(target)], mode=arg.mode, flags=arg.flags)
-			sys.exit(0)
+			sys.exit(1 if arg.fail_if_run else 0)
 		else:
 			path = target
 	else: