e30b3b094b
Generated by `pyupgrade --py3-plus --keep-percent-format` followed by manual indentation fixes. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
31 lines
649 B
Python
Executable file
31 lines
649 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
|
|
import zulip
|
|
|
|
usage = """mute-topic (mute | unmute) <stream> <topic> [options]
|
|
|
|
Example: mute-topic mute Verona dinner
|
|
Example: mute-topic unmute Denmark party
|
|
"""
|
|
|
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
|
parser.add_argument('op', choices=['mute', 'unmute'])
|
|
parser.add_argument('stream')
|
|
parser.add_argument('topic')
|
|
options = parser.parse_args()
|
|
|
|
client = zulip.init_from_options(options)
|
|
|
|
OPERATIONS = {
|
|
'mute': 'add',
|
|
'unmute': 'remove'
|
|
}
|
|
|
|
print(client.mute_topic({
|
|
'op': OPERATIONS[options.op],
|
|
'stream': options.stream,
|
|
'topic': options.topic
|
|
}))
|