summary refs log tree commit diff stats
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
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.
-rw-r--r--doc/ranger.16
-rwxr-xr-xranger.py2
-rw-r--r--ranger/__main__.py11
-rw-r--r--ranger/help/invocation.py9
4 files changed, 17 insertions, 11 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index b197d774..39c33973 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -33,9 +33,9 @@ Activate the clean mode:  Ranger will not access or create any configuration
 files nor will it leave any traces on your system.  This is useful when
 your configuration is broken, when you want to avoid clutter, etc.
 .TP
---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.
+`ranger --fail-unless-cd filename`.  This can be useful for scripts.
 .TP
 -r \fIdir\fR, --confdir=\fIdir\fR
 Define a different configuration directory.  The default is $HOME/.ranger.
@@ -176,7 +176,7 @@ of your parent shell after exiting ranger:
 .nf
 
 ranger() {
-    command ranger --fail-if-run $@ &&
+    command ranger --fail-unless-cd $@ &&
     cd "$(grep \\^\\' ~/.ranger/bookmarks | cut -b3-)"
 }
 .\"-----------------------------------------
diff --git a/ranger.py b/ranger.py
index aca1b557..ccc9f0d6 100755
--- a/ranger.py
+++ b/ranger.py
@@ -23,7 +23,7 @@
 # after you exit ranger by starting it with: source ranger ranger
 """":
 if [ $1 ]; then
-	$@ --fail-if-run && cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
+	$@ --fail-unless-cd && cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
 else
 	echo "usage: source path/to/ranger.py path/to/ranger.py"
 fi
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.
358' href='#n358'>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 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713