import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--test', action='store_true')
parsed, args = parser.parse_known_args()
print(parsed)
print(args)
How to parse positional arguments with leading minus sign (negative numbers) using argparse