zulip: Use canonical way to require an arg in subscribe.
This commit is contained in:
parent
a06437c4ee
commit
3fb640a5d0
|
@ -38,14 +38,10 @@ Specify your Zulip API credentials and server in a ~/.zuliprc file or using the
|
||||||
import zulip
|
import zulip
|
||||||
|
|
||||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||||
parser.add_argument('--streams', default='')
|
parser.add_argument('--streams', action='store', required=True)
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
client = zulip.init_from_options(options)
|
client = zulip.init_from_options(options)
|
||||||
|
|
||||||
if options.streams == "":
|
|
||||||
print("Usage:", parser.usage, file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print(client.add_subscriptions([{"name": stream_name} for stream_name in
|
print(client.add_subscriptions([{"name": stream_name} for stream_name in
|
||||||
options.streams.split()]))
|
options.streams.split()]))
|
||||||
|
|
Loading…
Reference in a new issue