Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_arguments(arguments):
argument_parser = argparse.ArgumentParser()
argument_parser.add_argument('--verbose', default=False, action='store_true', help=VERBOSE_OPTION_HELP)
argument_parser.add_argument('paths', metavar='path', nargs='+', help=PATH_ARGUMENT_HELP)
try:
parsed_arguments = argument_parser.parse_args(args=arguments)
except argparse.ArgumentError as error:
raise UsageError(str(error))
return parsed_arguments
def main():
try:
arguments = parse_arguments(sys.argv[1:])
except UsageError as error:
sys.stderr.write('{0}\n'.format(str(error)))
return 2
return_code = 0
for filename in arguments.paths:
result = VcardValidator(filename, arguments.verbose).result
if result is not None:
print(result)
return_code = 1
return return_code