From aa8548cfa6e8cf3963f7c4cccca4e46ddfc247bd Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Jun 14 2014 02:56:43 +0000 Subject: skeleton cli file, preparing for custom commands --- diff --git a/src/centpkg/cli.py b/src/centpkg/cli.py new file mode 100755 index 0000000..f0ea7c4 --- /dev/null +++ b/src/centpkg/cli.py @@ -0,0 +1,39 @@ +import sys +import os +import logging + +from pyrpkg.cli import cliClient + + +class centpkgClient(cliClient): + def __init__(self, config, name='centpkg'): + super(centpkgClient, self).__init__(config, name) + + +if __name__ == '__main__': + client = centpkgClient() + client.do_imports() + client.parse_cmdline() + + if not client.args.path: + try: + client.args.path=os.getcwd() + except: + print('Could not get current path') + sys.exit(1) + + log = client.site.log + client.setupLogging(log) + + if client.args.v: + log.setLevel(logging.DEBUG) + elif client.args.q: + log.setLevel(logging.WARNING) + else: + log.setLevel(logging.INFO) + + # Run the necessary command + try: + client.args.command() + except KeyboardInterrupt: + pass