MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / ParseArguments

Function ParseArguments

rtpose_wrapper/scripts/cpp_lint.py:4779–4846  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

4777
4778
4779def ParseArguments(args):
4780 """Parses the command line arguments.
4781
4782 This may set the output format and verbosity level as side-effects.
4783
4784 Args:
4785 args: The command line arguments:
4786
4787 Returns:
4788 The list of filenames to lint.
4789 """
4790 try:
4791 (opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
4792 'counting=',
4793 'filter=',
4794 'root=',
4795 'linelength=',
4796 'extensions='])
4797 except getopt.GetoptError:
4798 PrintUsage('Invalid arguments.')
4799
4800 verbosity = _VerboseLevel()
4801 output_format = _OutputFormat()
4802 filters = ''
4803 counting_style = ''
4804
4805 for (opt, val) in opts:
4806 if opt == '--help':
4807 PrintUsage(None)
4808 elif opt == '--output':
4809 if val not in ('emacs', 'vs7', 'eclipse'):
4810 PrintUsage('The only allowed output formats are emacs, vs7 and eclipse.')
4811 output_format = val
4812 elif opt == '--verbose':
4813 verbosity = int(val)
4814 elif opt == '--filter':
4815 filters = val
4816 if not filters:
4817 PrintCategories()
4818 elif opt == '--counting':
4819 if val not in ('total', 'toplevel', 'detailed'):
4820 PrintUsage('Valid counting options are total, toplevel, and detailed')
4821 counting_style = val
4822 elif opt == '--root':
4823 global _root
4824 _root = val
4825 elif opt == '--linelength':
4826 global _line_length
4827 try:
4828 _line_length = int(val)
4829 except ValueError:
4830 PrintUsage('Line length must be digits.')
4831 elif opt == '--extensions':
4832 global _valid_extensions
4833 try:
4834 _valid_extensions = set(val.split(','))
4835 except ValueError:
4836 PrintUsage('Extensions must be comma seperated list.')

Callers 1

mainFunction · 0.85

Calls 9

PrintUsageFunction · 0.85
_VerboseLevelFunction · 0.85
_OutputFormatFunction · 0.85
PrintCategoriesFunction · 0.85
_SetOutputFormatFunction · 0.85
_SetVerboseLevelFunction · 0.85
_SetFiltersFunction · 0.85
_SetCountingStyleFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected