Commit 279251f5 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

logger and arg fixes in cli

parent 21a96eb6
......@@ -19,13 +19,7 @@ import sys
import logging
import argparse
from agkyra import config
except ImportError:
sys.path.insert(0, "lib")
from agkyra import config
from agkyra import protocol, protocol_client, gui
from agkyra import protocol, protocol_client, gui, config
......@@ -44,7 +38,7 @@ NOTIFICATION = protocol.COMMON['NOTIFICATION']
remaining = lambda st: st['unsynced'] - (st['synced'] + st['failed'])
class ConfigCommands:
class ConfigCommands(object):
"""Commands for handling Agkyra config options"""
cnf = config.AgkyraConfig()
......@@ -130,7 +124,8 @@ class AgkyraCLI(cmd.Cmd):
def __init__(self, *args, **kwargs):
self.callback = kwargs.pop('callback', sys.argv[0])
self.args = kwargs.pop('parsed_args', None)
LOGGER.setLevel(logging.DEBUG if self.args.debug else logging.INFO)
if self.args.debug else logging.INFO)
cmd.Cmd.__init__(self, *args, **kwargs)
......@@ -166,13 +161,13 @@ class AgkyraCLI(cmd.Cmd):
def launch_daemon(self):
"""Launch the agkyra protocol server"""
LOGGER.debug('Start the session helper')'Starting the agkyra daemon')
if not self.helper.load_active_session():
self.helper.start()'Daemon is shut down')
else:'Another session is running, aborting')
LOGGER.debug('Session Helper is now down')'Another daemon is running, aborting')
def client(self):
......@@ -311,6 +306,10 @@ class AgkyraCLI(cmd.Cmd):
if line in ['daemon']:
return self.launch_daemon()
if line:
sys.stderr.write("Unrecognized subcommand '%s'.\n" % line)
client = self.client
if not client:
sys.stderr.write('No Agkyra daemons running, starting one')
......@@ -27,9 +27,6 @@ except ImportError:
from agkyra.cli import AgkyraCLI
CALLBACK = os.path.realpath(sys.argv[0])
if __name__ == "__main__":
args = AgkyraCLI.parse_args()
agkcli = AgkyraCLI(parsed_args=args)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment