summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-17 22:34:24 +0100
committerhut <hut@lavabit.com>2013-02-17 22:54:18 +0100
commit7e21fb55d06fda57db1f300840498a2855477cc5 (patch)
treeb1a4431fd462e6358c9ee1a645dd3e29c6a64d9b /ranger
parenta4e8f6e5961e043f059ea1eef9962d970d233591 (diff)
downloadranger-7e21fb55d06fda57db1f300840498a2855477cc5.tar.gz
core.main: made --fail-unless-cd deprecated
Instead of launching ranger for opening files, simply use rifle.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/main.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 579d40eb..a082b8fb 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -40,7 +40,7 @@ def main():
     if arg.copy_config is not None:
         fm = FM()
         fm.copy_config_files(arg.copy_config)
-        return 1 if arg.fail_unless_cd else 0
+        return 1 if arg.fail_unless_cd else 0 # COMPAT
     if arg.list_tagged_files:
         fm = FM()
         try:
@@ -54,7 +54,7 @@ def main():
                         sys.stdout.write(line[2:])
                 elif len(line) > 0 and '*' in arg.list_tagged_files:
                     sys.stdout.write(line)
-        return 1 if arg.fail_unless_cd else 0
+        return 1 if arg.fail_unless_cd else 0 # COMPAT
 
     SettingsAware._setup(clean=arg.clean)
 
@@ -82,7 +82,7 @@ def main():
             rifle = Rifle(rifleconf)
             rifle.reload_config()
             rifle.execute(targets, number=ranger.arg.mode, flags=ranger.arg.flags)
-            return 1 if arg.fail_unless_cd else 0
+            return 1 if arg.fail_unless_cd else 0 # COMPAT
 
     crash_traceback = None
     try:
@@ -101,7 +101,7 @@ def main():
             for key in range(33, 127):
                 if key not in maps:
                     print(chr(key))
-            return 1 if arg.fail_unless_cd else 0
+            return 1 if arg.fail_unless_cd else 0 # COMPAT
 
         if fm.username == 'root':
             fm.settings.preview_files = False
@@ -166,7 +166,7 @@ def main():
 
 def parse_arguments():
     """Parse the program arguments"""
-    from optparse import OptionParser
+    from optparse import OptionParser, SUPPRESS_HELP
     from os.path import expanduser
     from ranger import CONFDIR, USAGE, VERSION
     from ranger.ext.openstruct import OpenStruct
@@ -186,8 +186,7 @@ def parse_arguments():
             help="copy the default configs to the local config directory. "
             "Possible values: all, rc, rifle, commands, scope")
     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`)")
+            help=SUPPRESS_HELP)  # COMPAT
     parser.add_option('-r', '--confdir', type='string',
             metavar='dir', default=default_confdir,
             help="the configuration directory. (%default)")
@@ -224,6 +223,11 @@ def parse_arguments():
     arg = OpenStruct(options.__dict__, targets=positional)
     arg.confdir = expanduser(arg.confdir)
 
+    if arg.fail_unless_cd: # COMPAT
+        sys.stderr.write("Warning: The option --fail-unless-cd is deprecated.\n"
+            "It was used to faciliate using ranger as a file launcher.\n"
+            "Now, please use the standalone file launcher 'rifle' instead.\n")
+
     return arg