def main():
parser = argparse.ArgumentParser(description='PySketch - Write easy sketches in python.\n'
'Add "#!/usr/bin/env pysketch" to a sketchfile and make it executable to run from the shell')
parser.add_argument('sketchfile', type=str, help="file to load and execute")
parser.add_argument('sketch arguments', nargs=argparse.REMAINDER, help="arguments to the sketch")
parser.add_argument('-v, --version', action='version', version=__version__)
# Set up logger
logger = logging.getLogger('sketches')
ch = logging.StreamHandler()
formatter = logging.Formatter('[%(levelname)s]: %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
args = parser.parse_args().__dict__
try:
runner = SketchRunner(args['sketchfile'])
except FileNotFoundError:
exit()
runner.run(args['sketch arguments'])
评论列表
文章目录