Example #1
0
 def print_help(self):
     result = [self.format_option_help()]
     if self.epilog is not None:
         result.append(self.format_epilog(None))
     fail("\n".join(result))
Example #2
0
 def error(self, error):
     fail(error)
Example #3
0
       return self.epilog



   def print_help(self):
       result = [self.format_option_help()]
       if self.epilog is not None:
           result.append(self.format_epilog(None))
       fail("\n".join(result))




if __name__ == "__main__":

    import sys

    opt_parser = FailingOptionParser(epilog=
"""This is the epilog.
""")


    opt_parser.add_option("--foo",
                          help="foo",
                          action="store", type="string",
                          dest="foo")

    (options, remaining_args) = opt_parser.parse_args(sys.argv)
    if len(remaining_args) > 1:
        fail("Found extra arguments: %s" % remaining_args)
Example #4
0
 def print_help(self):
     result = [self.format_option_help()]
     if self.epilog is not None:
         result.append(self.format_epilog(None))
     fail("\n".join(result))
Example #5
0
 def error(self, error):
     fail(error)
Example #6
0
        # Drop the last "\n", or the header if no options or option groups:
        return "".join(result[:-1])

    # Format the epilog verbatim
    def format_epilog(self, formatter):
        return self.epilog

    def print_help(self):
        result = [self.format_option_help()]
        if self.epilog is not None:
            result.append(self.format_epilog(None))
        fail("\n".join(result))


if __name__ == "__main__":

    import sys

    opt_parser = FailingOptionParser(epilog="""This is the epilog.
    """)

    opt_parser.add_option("--foo",
                          help="foo",
                          action="store",
                          type="string",
                          dest="foo")

    (options, remaining_args) = opt_parser.parse_args(sys.argv)
    if len(remaining_args) > 1:
        fail("Found extra arguments: %s" % remaining_args)