#!/usr/bin/python3 # $HeadURL$ $LastChangedRevision$ # Modules import subprocess import os import sys sys.path.append(subprocess.Popen(['miniade', '--dirname'], stdout=subprocess.PIPE, universal_newlines=True).communicate()[0].rstrip()) import miniade # Configurable stuff # Other globals def main(): global qaz, wsx # Defaults for options qaz = False wsx = None # Process options def special_opts_handler(): global qaz, wsx if sys.argv[1] == '--qaz': qaz = True # This is a bad option: it's multichar but wants a *separate* argument (i.e. not with '=') elif sys.argv[1] == '--wsx': if len(sys.argv) < 3: return False wsx = sys.argv[2] del sys.argv[1] else: return False return True miniade.process_options(special_opts_handler, help) # Process arguments if len(sys.argv) != 1: miniade.bad_usage() # Sanity checks and derivations # Guts miniade.info('running ...') miniade.debug(10, 'this is a debug message') print('qaz=%s' % (qaz)) print('wsx=%s' % (wsx)) def help(): progname = miniade.get_progname() sys.stdout.write('Usage: %s [ ] [ --qaz ] [ --wsx ]\n' % (progname)) sys.exit(0) # Entry point if __name__=="__main__": main()