Parses the command line arguments. This may set the output format and verbosity level as side-effects. Args: args: The command line arguments: Returns: The list of filenames to lint.
(args)
| 7797 | |
| 7798 | |
| 7799 | def ParseArguments(args): |
| 7800 | """Parses the command line arguments. |
| 7801 | |
| 7802 | This may set the output format and verbosity level as side-effects. |
| 7803 | |
| 7804 | Args: |
| 7805 | args: The command line arguments: |
| 7806 | |
| 7807 | Returns: |
| 7808 | The list of filenames to lint. |
| 7809 | """ |
| 7810 | try: |
| 7811 | (opts, filenames) = getopt.getopt( |
| 7812 | args, |
| 7813 | "", |
| 7814 | [ |
| 7815 | "help", |
| 7816 | "output=", |
| 7817 | "verbose=", |
| 7818 | "v=", |
| 7819 | "version", |
| 7820 | "counting=", |
| 7821 | "filter=", |
| 7822 | "root=", |
| 7823 | "repository=", |
| 7824 | "linelength=", |
| 7825 | "extensions=", |
| 7826 | "exclude=", |
| 7827 | "recursive", |
| 7828 | "headers=", |
| 7829 | "third_party_headers=", |
| 7830 | "includeorder=", |
| 7831 | "config=", |
| 7832 | "quiet", |
| 7833 | ], |
| 7834 | ) |
| 7835 | except getopt.GetoptError: |
| 7836 | PrintUsage("Invalid arguments.") |
| 7837 | |
| 7838 | verbosity = _VerboseLevel() |
| 7839 | output_format = _OutputFormat() |
| 7840 | filters = "" |
| 7841 | quiet = _Quiet() |
| 7842 | counting_style = "" |
| 7843 | recursive = False |
| 7844 | |
| 7845 | for opt, val in opts: |
| 7846 | if opt == "--help": |
| 7847 | PrintUsage(None) |
| 7848 | if opt == "--version": |
| 7849 | PrintVersion() |
| 7850 | elif opt == "--output": |
| 7851 | if val not in ("emacs", "vs7", "eclipse", "junit", "sed", "gsed"): |
| 7852 | PrintUsage( |
| 7853 | "The only allowed output formats are emacs, vs7, eclipse sed, gsed and junit." |
| 7854 | ) |
| 7855 | output_format = val |
| 7856 | elif opt == "--quiet": |
no test coverage detected
searching dependent graphs…