summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-06-09 13:11:06 +0200
committerhut <hut@lavabit.com>2010-06-09 13:11:06 +0200
commitaefd8048d2b246c0111ac1227ade2a9a9d38c35c (patch)
tree89e4b939878df48375def317c2225ba6cf917efd /ranger
parent57deeb86a73e527e7de3881cd5aa1488629695cf (diff)
downloadranger-aefd8048d2b246c0111ac1227ade2a9a9d38c35c.tar.gz
renamed "--fail-if-run" to the more accurate "--fail-unless-cd"
The old name, --fail-if-run, is still valid and working.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/__main__.py11
-rw-r--r--ranger/help/invocation.py9
2 files changed, 13 insertions, 7 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index ff5cdc4d..a03509cf 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -26,7 +26,7 @@ import sys
 
 def parse_arguments():
 	"""Parse the program arguments"""
-	from optparse import OptionParser
+	from optparse import OptionParser, SUPPRESS_HELP
 	from ranger import __version__, USAGE, DEFAULT_CONFDIR
 	from ranger.ext.openstruct import OpenStruct
 	parser = OptionParser(usage=USAGE, version='ranger ' + __version__)
@@ -35,7 +35,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',
+	parser.add_option('--fail-if-run', action='store_true', # COMPAT
+			help=SUPPRESS_HELP)
+	parser.add_option('--fail-unless-cd', 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',
@@ -50,6 +52,9 @@ def parse_arguments():
 	options, positional = parser.parse_args()
 	arg = OpenStruct(options.__dict__, targets=positional)
 	arg.confdir = os.path.expanduser(arg.confdir)
+	if arg.fail_if_run:
+		arg.fail_unless_cd = arg.fail_if_run
+		del arg['fail_if_run']
 
 	return arg
 
@@ -185,7 +190,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(1 if arg.fail_if_run else 0)
+			sys.exit(1 if arg.fail_unless_cd else 0)
 		else:
 			path = target
 	else:
diff --git a/ranger/help/invocation.py b/ranger/help/invocation.py
index 3de574cc..26cffd4a 100644
--- a/ranger/help/invocation.py
+++ b/ranger/help/invocation.py
@@ -43,9 +43,10 @@ command line.
       This is useful when your configuration is broken, when you want
       to avoid clutter, etc.
 
---fail-if-run
+--fail-unless-cd
       Return the exit code 1 if ranger is used to run a file, for example
-      with `ranger --fail-if-run filename`.  This can be useful for scripts.
+      with `ranger --fail-unless-cd filename`.  This can be useful for scripts.
+      (This option used to be called --fail-if-run)
 
 -r <dir>, --confdir=<dir>
       Define a different configuration directory.  The default is
@@ -69,7 +70,7 @@ command line.
 Examples:
       ranger episode1.avi
       ranger --debug /usr/bin
-      ranger --confdir=~/.config/ranger --fail-if-run
+      ranger --confdir=~/.config/ranger --fail-unless-cd
 
 
 ==============================================================================
@@ -95,7 +96,7 @@ docstrings.  Use this option if you don't need the documentation.
 Examples:
       PYTHONOPTIMIZE=1 ranger episode1.avi
       PYTHONOPTIMIZE=2 ranger --debug /usr/bin
-      python -OO `which ranger` --confdir=~/.config/ranger --fail-if-run
+      python -OO `which ranger` --confdir=~/.config/ranger --fail-unless-cd
 
 Note: The author expected "-OO" to reduce the memory usage, but that
 doesn't seem to happen.