Browse Source

Show extra help message after option list

Use OptionGroup for hack
Matthew Wang 11 years ago
parent
commit
5f671d7bdd
1 changed files with 9 additions and 1 deletions
  1. 9
    1
      cdiff.py

+ 9
- 1
cdiff.py View File

@@ -644,7 +644,8 @@ def decode(line):
644 644
 
645 645
 
646 646
 def main():
647
-    from optparse import (OptionParser, BadOptionError, AmbiguousOptionError)
647
+    from optparse import (OptionParser, BadOptionError, AmbiguousOptionError,
648
+                          OptionGroup)
648 649
 
649 650
     class PassThroughOptionParser(OptionParser):
650 651
         """Stop parsing on first unknown option (e.g. --cached, -U10) and pass
@@ -682,6 +683,13 @@ def main():
682 683
     parser.add_option(
683 684
         '-c', '--color', default='auto', metavar='M',
684 685
         help="""colorize mode 'auto' (default), 'always', or 'never'""")
686
+
687
+    # Hack: use OptionGroup text for extra help message after option list
688
+    option_group = OptionGroup(
689
+        parser, "Note", ("Option parser will stop on first unknown option "
690
+                         "and pass them down to underneath revision control"))
691
+    parser.add_option_group(option_group)
692
+
685 693
     opts, args = parser.parse_args()
686 694
 
687 695
     if opts.log: