aboutsummaryrefslogtreecommitdiffstats
path: root/python/examples
diff options
context:
space:
mode:
authorDevendra2014-05-01 00:14:25 +0530
committerDevendra2014-05-01 00:14:25 +0530
commit06511b3849e80cb5692ed92f7da31043c85556a0 (patch)
tree3b1f667a691cefdbceef26e8a4a4453186a87654 /python/examples
parent10f345fcf4edb489cf9b86039c030baa62a6881c (diff)
downloadpubnub-python-06511b3849e80cb5692ed92f7da31043c85556a0.tar.bz2
more chagnes to console
Diffstat (limited to 'python/examples')
-rw-r--r--python/examples/console.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/python/examples/console.py b/python/examples/console.py
index e96b4e5..240e5c0 100644
--- a/python/examples/console.py
+++ b/python/examples/console.py
@@ -202,11 +202,12 @@ class DevConsole(Cmd):
def __init__(self):
Cmd.__init__(self)
global pubnub
- self.prompt = "(PubNub Console) > "
- self.intro = "Welcome to PubNub Developer Console!" ## defaults to None
+ self.intro = "For Help type ? or help . To quit/exit type exit" ## defaults to None
self.default_channel = None
self.async = False
pubnub = Pubnub("demo", "demo")
+ self.prompt = "(PubNub Console) [" + color.colorize(pubnub.get_origin(),"blue") + "] > "
+
def cmdloop_with_keyboard_interrupt(self):
try:
@@ -235,12 +236,17 @@ class DevConsole(Cmd):
opts.ssl,
opts.origin,
opts.uuid)
+ self.prompt = "(PubNub Console) [" + color.colorize(pubnub.get_origin(),"blue") + "] > "
def do_set_sync(self, command):
+ """unset_async
+ Unset Async mode"""
self.async = False
def do_set_async(self, command):
+ """set_async
+ Set Async mode"""
self.async = True
@@ -361,7 +367,9 @@ class DevConsole(Cmd):
_unsubscribe_command_handler(opts.channel)
- @options([make_option('-c', '--channel', action="store", help="Channel for subscribe")
+ @options([make_option('-c', '--channel', action="store", help="Channel for subscribe"),
+ make_option('-g', '--get-channel-list', action="store_true", dest="get",
+ default=False, help="Get susbcribed channel list")
])
def do_subscribe(self, command, opts):
opts.channel = self.default_channel if opts.channel is None else opts.channel
@@ -369,11 +377,11 @@ class DevConsole(Cmd):
print_error("Missing argument")
return
- if opts.channel is None:
- print_error("Missing channel")
- return
+ if opts.channel is not None:
+ _subscribe_command_handler(opts.channel)
- _subscribe_command_handler(opts.channel)
+ if opts.get is True:
+ print_ok(pubnub.get_channel_array())
def do_exit(self, args):
kill_all_threads()