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
 
 
n248'>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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422