From e3c69efda378640aa015cf0b56aaff2617dbd5b7 Mon Sep 17 00:00:00 2001 From: Lincoln de Sousa Date: Sat, 12 May 2012 14:37:29 -0300 Subject: [PATCH] Using the `line` param in the help command (py-ddp-client) --- .../python-ddp-client/ddp-client.py | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/examples/unfinished/python-ddp-client/ddp-client.py b/examples/unfinished/python-ddp-client/ddp-client.py index 17a1d15169..e2bb093155 100755 --- a/examples/unfinished/python-ddp-client/ddp-client.py +++ b/examples/unfinished/python-ddp-client/ddp-client.py @@ -168,16 +168,27 @@ class App(Cmd): def do_help(self, line): """The `help` command""" - log('') - log('call \n' - ' Calls a remote method\n' - ' Example: call createApp [{"name": "foo.meteor.com", ' - '"description": "bar"}]') - log('') - log('sub []\n' - ' Subscribes to a remote dataset\n' - ' Examples: `sub allApps` or `sub myApp ["foo.meteor.com"]`') - log('') + + msgs = { + 'call': ( + 'call \n' + ' Calls a remote method\n' + ' Example: call createApp ' + '[{"name": "foo.meteor.com", ' + '"description": "bar"}]'), + 'sub': ( + 'sub []\n' + ' Subscribes to a remote dataset\n' + ' Examples: `sub allApps` or `sub myApp ' + '["foo.meteor.com"]`'), + } + + line = line.strip() + if line and line in msgs: + return log('\n' + msgs[line]) + + for msg in msgs.values(): + log('\n' + msg) def next_id(self): """Calculates the next id for messages that will be sent to the