Kaynağa Gözat

Show extra help message after option list

Use OptionGroup for hack
Matthew Wang 11 yıl önce
ebeveyn
işleme
5f671d7bdd
1 değiştirilmiş dosya ile 9 ekleme ve 1 silme
  1. 9
    1
      cdiff.py

+ 9
- 1
cdiff.py Dosyayı Görüntüle

@@ -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: