From 8969490de9e77c1db842d0e5a33be3d82763f9c6 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 20 Jul 2017 16:44:05 +0200 Subject: get info is better than before --- lib/commands.py | 10 ++-------- lib/listcommands.py | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/commands.py b/lib/commands.py index e016772..1302195 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -43,16 +43,10 @@ class Commands(object): print(r.hget('user:'+host, 'name').decode('utf-8')) else: print('nil') - elif cmd[2] == 'host': - print(co['host']) - elif cmd[2] == 'port': - print(co['post']) - elif cmd[2] == 'socket_path': - print(co['unix_socket_path']) - elif cmd[2] == 'db': - print(co['db']) elif cmd[2] not in ListCommands.commands['get'][1]: ListCommands.err('keyword') + else: + print(co[cmd[2]]) elif cmd[1] == 'user?': if len(cmd) > 3: raise PersonalError(Colors.grey + 'get user?' + Colors.red + ' accetta 1 parametro') diff --git a/lib/listcommands.py b/lib/listcommands.py index 04202a4..2d90cea 100644 --- a/lib/listcommands.py +++ b/lib/listcommands.py @@ -13,7 +13,7 @@ class ListCommands(object): 'quit' : None, 'clear' : None, 'set' : ['user'], - 'get' : ['i', ['user', 'host', 'port', 'socket_path', 'db'], 'user?'] + 'get' : ['i', ['user', 'host', 'port', 'unix_socket_path', 'db'], 'user?'] } @staticmethod -- cgit v1.2.3-18-g5258