zulip/examples: Use argparse-based zulip.add_default_arguments.
This commit is contained in:
parent
38df8ef87b
commit
4a76284af1
13 changed files with 57 additions and 71 deletions
|
@ -25,7 +25,7 @@ from __future__ import print_function
|
|||
import sys
|
||||
import os
|
||||
import json
|
||||
import optparse
|
||||
import argparse
|
||||
|
||||
usage = """recent-messages [options] --count=<no. of previous messages> --user=<sender's email address> --api-key=<sender's api key>
|
||||
|
||||
|
@ -38,10 +38,9 @@ You can omit --user and --api-key arguments if you have a properly set up ~/.zul
|
|||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option('--count', default=100)
|
||||
parser.add_option_group(zulip.generate_option_group(parser))
|
||||
(options, args) = parser.parse_args()
|
||||
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
||||
parser.add_argument('--count', default=100)
|
||||
options = parser.parse_args()
|
||||
|
||||
client = zulip.init_from_options(options)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue