Fixed catching unnececcary exceptions
Exception Abort can't be thrown, so it is useless.
Catching SystemExit and KeyboardInterrupt makes little sense as the thread can
be terminated by KeyboardInterrupt before or after entering the wrapped command
processing function. So one have to handle these exceptions in his main function
anyway.
Catching any exception in order to print a message and re-raise it changes the
standard behaviour and might seem confusing.
#!/usr/bin/env python
from opster import command
a = 0
@command(usage="%name [-p|--pptx] [-x|--xslx] [-w|--wrdx] [-a|--abstract]")
def main(pptx=('p', False, 'should we generate pptx related code'),
xslx=('x', False, 'should we generate xslx related code'),
wrdx=('w', False, 'should we generate wrdx related code'),
abstract=('a', False, 'should we generate abstract ifaces')):
"""
Code generation tool. Run without params to regenerate all the code
"""
global a
a = 42
if __name__ == '__main__':
main()
assert a == 42, "WTF???"