Commit 90ab166c authored by Seblu's avatar Seblu
Browse files

command uptime

parent e5d6941d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -247,6 +247,19 @@ class Command(object):
        self.printer.out("\033[H\033[2J", nl="")
    cmd_clear.usage = "clear"

    def cmd_uptime(self, argv):
        '''Show connection uptime'''
        if len(argv) == 1:
            argv.append(self.cli.settings["login"])
        tql = "a~(%s)$con"%"|".join(argv[1:])
        try:
            objs = self.cli.rpc.list(tql)
        except RpcError as e:
            raise cmdError("RPCError: %s"%str(e))
        for o in objs:
            self.printer.out("%s: %ss"%(o["a"],o["con"]))
    cmd_uptime.usage = "uptime [login]"


class Alias(dict):
    ''' Alias wrapper'''