|
3 | 3 | from __future__ import unicode_literals |
4 | 4 |
|
5 | 5 | from datetime import date |
| 6 | +import argparse |
6 | 7 | import io |
7 | 8 | import locale |
8 | 9 | import operator |
9 | | -import optparse |
10 | 10 | import os |
11 | 11 | import re |
12 | 12 | import sys |
@@ -626,38 +626,38 @@ class CppCheckHandler(XmlContentHandler): |
626 | 626 |
|
627 | 627 | def main() -> None: |
628 | 628 | # Configure all the options this little utility is using. |
629 | | - parser = optparse.OptionParser() |
630 | | - parser.add_option('--title', dest='title', |
631 | | - help='The title of the project.', |
632 | | - default='[project name]') |
633 | | - parser.add_option('--file', dest='file', action="append", |
634 | | - help='The cppcheck xml output file to read defects ' |
635 | | - 'from. You can combine results from several ' |
636 | | - 'xml reports i.e. "--file file1.xml --file file2.xml ..". ' |
637 | | - 'Default is reading from stdin.') |
638 | | - parser.add_option('--checkers-report-file', dest='checkers_report', |
| 629 | + parser = argparse.ArgumentParser() |
| 630 | + parser.add_argument('--title', dest='title', |
| 631 | + help='The title of the project.', |
| 632 | + default='[project name]') |
| 633 | + parser.add_argument('--file', dest='file', action="append", |
| 634 | + help='The cppcheck xml output file to read defects ' |
| 635 | + 'from. You can combine results from several ' |
| 636 | + 'xml reports i.e. "--file file1.xml --file file2.xml ..". ' |
| 637 | + 'Default is reading from stdin.') |
| 638 | + parser.add_argument('--checkers-report-file', dest='checkers_report', |
639 | 639 | help='The cppcheck checkers report file as produced ' |
640 | 640 | 'with the "--checkers-report" option of cppcheck.') |
641 | | - parser.add_option('--report-dir', dest='report_dir', |
642 | | - help='The directory where the HTML report content is ' |
643 | | - 'written.') |
644 | | - parser.add_option('--source-dir', dest='source_dir', |
645 | | - help='Base directory where source code files can be ' |
646 | | - 'found.') |
647 | | - parser.add_option('--add-author-information', dest='add_author_information', |
648 | | - help='Blame information to include. ' |
649 | | - 'Adds specified author information. ' |
650 | | - 'Specify as comma-separated list of either "name", "email", "date" or "n","e","d". ' |
651 | | - 'Default: "n,e,d"') |
652 | | - parser.add_option('--source-encoding', dest='source_encoding', |
| 641 | + parser.add_argument('--report-dir', dest='report_dir', |
| 642 | + help='The directory where the HTML report content is ' |
| 643 | + 'written.') |
| 644 | + parser.add_argument('--source-dir', dest='source_dir', |
| 645 | + help='Base directory where source code files can be ' |
| 646 | + 'found.') |
| 647 | + parser.add_argument('--add-author-information', dest='add_author_information', |
| 648 | + help='Blame information to include. ' |
| 649 | + 'Adds specified author information. ' |
| 650 | + 'Specify as comma-separated list of either "name", "email", "date" or "n","e","d". ' |
| 651 | + 'Default: "n,e,d"') |
| 652 | + parser.add_argument('--source-encoding', dest='source_encoding', |
653 | 653 | help='Encoding of source code.', default='utf-8') |
654 | | - parser.add_option('--blame-options', dest='blame_options', |
655 | | - help='[-w, -M] blame options which you can use to get author and author mail ' |
656 | | - '-w --> not including white spaces and returns original author of the line ' |
657 | | - '-M --> not including moving of lines and returns original author of the line') |
| 654 | + parser.add_argument('--blame-options', dest='blame_options', |
| 655 | + help='[-w, -M] blame options which you can use to get author and author mail ' |
| 656 | + '-w --> not including white spaces and returns original author of the line ' |
| 657 | + '-M --> not including moving of lines and returns original author of the line') |
658 | 658 |
|
659 | 659 | # Parse options and make sure that we have an output directory set. |
660 | | - options, _ = parser.parse_args() |
| 660 | + options = parser.parse_args() |
661 | 661 |
|
662 | 662 | try: |
663 | 663 | sys.argv[1] |
|
0 commit comments