#!/usr/bin/env python3 """.""" import sys def usage(retval): """Output a usage message.""" if retval == 0: w = sys.stdout.write else: w = sys.stderr.write w(f'Usage: {sys.argv[0]} --help\n') sys.exit(retval) def main(): """Start the ball rolling.""" while sys.argv[1:]: if sys.argv[1] in ('-h', '--help'): usage(0) else: sys.stderr.write(f'{sys.argv[0]}: unrecognized option: {sys.argv[1]}\n') usage(1) del sys.argv[1] print('Hello world!') if __name__ == '__main__': main()