mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-23 16:22:55 +00:00
skeleton cli file, preparing for custom commands
This commit is contained in:
parent
5746a3bc38
commit
aa8548cfa6
1 changed files with 39 additions and 0 deletions
39
src/centpkg/cli.py
Executable file
39
src/centpkg/cli.py
Executable file
|
@ -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
|
Loading…
Add table
Reference in a new issue