diff --git a/api/examples/print-messages b/api/examples/print-messages index 8dac6786a9..a20dc19783 100755 --- a/api/examples/print-messages +++ b/api/examples/print-messages @@ -25,9 +25,9 @@ import sys from os import path import optparse -usage = """print-messages --user= [options] +usage = """print-messages --user= [--stream=] [options] -Prints out each message received by the indicated user. +Prints out each message received by the indicated user, or on the indicated public stream. Example: print-messages --user=tabbott@humbughq.com --site=https://zephyr.humbughq.com """ @@ -36,6 +36,7 @@ import humbug parser = optparse.OptionParser(usage=usage) parser.add_option_group(humbug.generate_option_group(parser)) +parser.add_option('--stream', default=None) (options, args) = parser.parse_args() client = humbug.init_from_options(options) @@ -43,4 +44,7 @@ client = humbug.init_from_options(options) def print_message(message): print message -client.call_on_each_message(print_message) +get_messages_options = {} +if options.stream is not None: + get_messages_options['stream_name'] = options.stream +client.call_on_each_message(print_message, get_messages_options) diff --git a/api/examples/print-next-message b/api/examples/print-next-message index 396f501284..e0b3294e10 100755 --- a/api/examples/print-next-message +++ b/api/examples/print-next-message @@ -25,9 +25,9 @@ import sys from os import path import optparse -usage = """print-next-message --user= [options] +usage = """print-next-message --user= [--stream=] [options] -Prints out the next message received by the user. +Prints out the next message received by the indicated user, or on the indicated public stream. Example: print-next-messages --user=tabbott@humbughq.com --site=https://zephyr.humbughq.com """ @@ -36,8 +36,12 @@ import humbug parser = optparse.OptionParser(usage=usage) parser.add_option_group(humbug.generate_option_group(parser)) +parser.add_option('--stream', default=None) (options, args) = parser.parse_args() client = humbug.init_from_options(options) -print client.get_messages({}) +get_messages_options = {} +if options.stream is not None: + get_messages_options['stream_name'] = options.stream +print client.get_messages(get_messages_options)