zulip-export: Convert to using argparse from optparse.

This commit is contained in:
rht 2017-11-10 06:03:41 +01:00 committed by Tim Abbott
parent f689813f38
commit 5ff690d486
1 changed files with 4 additions and 5 deletions

View File

@ -23,7 +23,7 @@
import sys import sys
import os import os
import optparse import argparse
import time import time
import json import json
usage = """Export all messages on a given stream to a JSON dump. usage = """Export all messages on a given stream to a JSON dump.
@ -39,10 +39,9 @@ This script requires the Zulip API bindings to be installed."""
sys.path.append(os.path.join(os.path.dirname(__file__), '../../api')) sys.path.append(os.path.join(os.path.dirname(__file__), '../../api'))
import zulip import zulip
parser = optparse.OptionParser(usage=usage) parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
parser.add_option_group(zulip.generate_option_group(parser)) parser.add_argument('--stream', default='', action="store")
parser.add_option('--stream', default='') options = parser.parse_args()
(options, args) = parser.parse_args()
client = zulip.init_from_options(options) client = zulip.init_from_options(options)