Use argparse in runtests

like Zeus intended
This commit is contained in:
Dan Buch 2016-05-10 08:16:33 -04:00
parent 33f5de5f18
commit 1398157654
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import print_function from __future__ import print_function
import argparse
import os import os
import sys import sys
import tempfile import tempfile
@ -14,16 +15,19 @@ PACKAGE_NAME = os.environ.get(
def main(sysargs=sys.argv[:]): def main(sysargs=sys.argv[:]):
target = 'test' targets = {
if len(sysargs) > 1:
target = sysargs[1]
{
'vet': _vet, 'vet': _vet,
'test': _test, 'test': _test,
'gfmxr': _gfmxr 'gfmxr': _gfmxr
}[target]() }
parser = argparse.ArgumentParser()
parser.add_argument(
'target', nargs='?', choices=tuple(targets.keys()), default='test'
)
args = parser.parse_args(sysargs[1:])
targets[args.target]()
return 0 return 0