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
 
644
 
645
 
645
 
646
 def main():
646
 def main():
647
-    from optparse import (OptionParser, BadOptionError, AmbiguousOptionError)
647
+    from optparse import (OptionParser, BadOptionError, AmbiguousOptionError,
648
+                          OptionGroup)
648
 
649
 
649
     class PassThroughOptionParser(OptionParser):
650
     class PassThroughOptionParser(OptionParser):
650
         """Stop parsing on first unknown option (e.g. --cached, -U10) and pass
651
         """Stop parsing on first unknown option (e.g. --cached, -U10) and pass
682
     parser.add_option(
683
     parser.add_option(
683
         '-c', '--color', default='auto', metavar='M',
684
         '-c', '--color', default='auto', metavar='M',
684
         help="""colorize mode 'auto' (default), 'always', or 'never'""")
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
     opts, args = parser.parse_args()
693
     opts, args = parser.parse_args()
686
 
694
 
687
     if opts.log:
695
     if opts.log: