_DEBUG_FORCE=None# Ignore -d/--debug if this is not none.
defparse_options(argv:List[str]=None):
"""Parse command line arguments and return an argparse Namespace object."""
parser=argparse.ArgumentParser(description="Query the compiler filter for a package.")
# argparse considers args starting with - and -- optional in --help, even though required=True.
# by using a named argument group --help will clearly say that it's required instead of optional.
required_named=parser.add_argument_group('required named arguments')
required_named.add_argument('-p','--package',action='store',dest='package',help='package of the application',required=True)
# optional arguments
# use a group here to get the required arguments to appear 'above' the optional arguments in help.
optional_named=parser.add_argument_group('optional named arguments')
optional_named.add_argument('-i','--isa','--instruction-set',action='store',dest='instruction_set',help='which instruction set to select. defaults to the first one available if not specified.',choices=('arm64','arm','x86_64','x86'))
optional_named.add_argument('-s','--simulate',dest='simulate',action='store_true',help='Print which commands will run, but don\'t run the apps')
optional_named.add_argument('-d','--debug',dest='debug',action='store_true',help='Add extra debugging output')