Finish the improvements I planned.
- No more manual args manipulation -- getopts used for everything. As a result, options can be in any position, now, even before the subcommand. - The additional options for test, bench, and dist now appear in the help output. - No more single-letter variable bindings used internally for large scopes. - Don't output the time measurement when just invoking 'x.py' - Logic is now much more linear. We build strings up, and then print them.
This commit is contained in:
parent
5ba579e7f4
commit
aa4bd0ec0e
3 changed files with 113 additions and 125 deletions
|
@ -591,9 +591,10 @@ def bootstrap():
|
|||
|
||||
def main():
|
||||
start_time = time()
|
||||
help_triggered = ('-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
|
||||
try:
|
||||
bootstrap()
|
||||
if ('-h' not in sys.argv) and ('--help' not in sys.argv):
|
||||
if not help_triggered:
|
||||
print("Build completed successfully in %s" % format_build_time(time() - start_time))
|
||||
except (SystemExit, KeyboardInterrupt) as e:
|
||||
if hasattr(e, 'code') and isinstance(e.code, int):
|
||||
|
@ -601,7 +602,7 @@ def main():
|
|||
else:
|
||||
exit_code = 1
|
||||
print(e)
|
||||
if ('-h' not in sys.argv) and ('--help' not in sys.argv):
|
||||
if not help_triggered:
|
||||
print("Build completed unsuccessfully in %s" % format_build_time(time() - start_time))
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue