diff options
author | Santo Cariotti <sancn@live.com> | 2017-07-20 16:44:05 +0200 |
---|---|---|
committer | Santo Cariotti <sancn@live.com> | 2017-07-20 16:44:05 +0200 |
commit | 8969490de9e77c1db842d0e5a33be3d82763f9c6 (patch) | |
tree | ea13a2d02bfe6afe09b84bf70688720e2a0a2ae1 | |
parent | 3a8127c40245dc9af4da5173b576d872dc0973b1 (diff) |
get info is better than before
-rw-r--r-- | lib/commands.py | 10 | ||||
-rw-r--r-- | lib/listcommands.py | 2 |
2 files changed, 3 insertions, 9 deletions
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 |