33 lines
605 B
Python
33 lines
605 B
Python
from . import cli
|
|
|
|
from . import login, sync
|
|
|
|
import logging
|
|
|
|
_logMap = {
|
|
0: logging.WARNING,
|
|
1: logging.INFO,
|
|
2: logging.DEBUG
|
|
}
|
|
|
|
_runMap = {
|
|
'login': login.run,
|
|
'sync': sync.run,
|
|
}
|
|
|
|
def main():
|
|
args = cli.getArgs(
|
|
loginSpCb=login.buildSubparser,
|
|
syncSpCb=sync.buildSubparser
|
|
)
|
|
logging.basicConfig()
|
|
_l = logging.getLogger(__name__)
|
|
_l.setLevel(_logMap.get(args.verbose, logging.DEBUG))
|
|
|
|
_l.debug('Parameters %s', args)
|
|
if args.mode in _runMap:
|
|
_runMap[args.mode](args)
|
|
else:
|
|
_l.error('Unknown mode %s', args.mode)
|
|
|