sync_public_streams: Use option group for arguments.

This commit is contained in:
Tim Abbott 2017-03-20 12:14:38 -07:00
parent 362d7424ed
commit beb2a6570f

View file

@ -2,6 +2,7 @@
import sys import sys
import os import os
import logging import logging
import optparse
import time import time
import simplejson import simplejson
import subprocess import subprocess
@ -12,8 +13,6 @@ import zulip
from typing import Set from typing import Set
zulip_client = zulip.Client(client="ZulipSyncPublicStreamsBot/0.1")
def fetch_public_streams(): def fetch_public_streams():
# type: () -> Set[str] # type: () -> Set[str]
public_streams = set() public_streams = set()
@ -56,6 +55,12 @@ if __name__ == "__main__":
file_handler.setFormatter(formatter) file_handler.setFormatter(formatter)
logger.addHandler(file_handler) logger.addHandler(file_handler)
parser = optparse.OptionParser()
parser.add_option_group(zulip.generate_option_group(parser))
(options, args) = parser.parse_args()
zulip_client = zulip.Client(client="ZulipSyncPublicStreamsBot/0.1")
while True: while True:
time.sleep(15) time.sleep(15)
public_streams = fetch_public_streams() public_streams = fetch_public_streams()