Skip to content

Commit 09060af

Browse files
eeshangargtimabbott
authored andcommitted
integrations/rss: Upgrade to argparse.
1 parent c448031 commit 09060af

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

zulip/integrations/rss/rss-bot

100644100755
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import errno
2929
import hashlib
3030
from six.moves.html_parser import HTMLParser
3131
import logging
32-
import optparse
32+
import argparse
3333
import os
3434
import re
3535
import sys
@@ -67,34 +67,34 @@ stream every 5 minutes is:
6767
6868
*/5 * * * * /usr/local/share/zulip/integrations/rss/rss-bot"""
6969

70-
parser = optparse.OptionParser(usage) # type: optparse.OptionParser
71-
parser.add_option('--stream',
72-
dest='stream',
73-
help='The stream to which to send RSS messages.',
74-
default="rss",
75-
action='store')
76-
parser.add_option('--data-dir',
77-
dest='data_dir',
78-
help='The directory where feed metadata is stored',
79-
default=os.path.join(RSS_DATA_DIR),
80-
action='store')
81-
parser.add_option('--feed-file',
82-
dest='feed_file',
83-
help='The file containing a list of RSS feed URLs to follow, one URL per line',
84-
default=os.path.join(RSS_DATA_DIR, "rss-feeds"),
85-
action='store')
86-
parser.add_option('--unwrap',
87-
dest='unwrap',
88-
action='store_true',
89-
help='Convert word-wrapped paragraphs into single lines',
90-
default=False)
91-
parser.add_option('--math',
92-
dest='math',
93-
action='store_true',
94-
help='Convert $ to $$ (for KaTeX processing)',
95-
default=False)
96-
parser.add_option_group(zulip.generate_option_group(parser))
97-
(opts, args) = parser.parse_args() # type: Tuple[Any, List[str]]
70+
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage)) # type: argparse.ArgumentParser
71+
parser.add_argument('--stream',
72+
dest='stream',
73+
help='The stream to which to send RSS messages.',
74+
default="rss",
75+
action='store')
76+
parser.add_argument('--data-dir',
77+
dest='data_dir',
78+
help='The directory where feed metadata is stored',
79+
default=os.path.join(RSS_DATA_DIR),
80+
action='store')
81+
parser.add_argument('--feed-file',
82+
dest='feed_file',
83+
help='The file containing a list of RSS feed URLs to follow, one URL per line',
84+
default=os.path.join(RSS_DATA_DIR, "rss-feeds"),
85+
action='store')
86+
parser.add_argument('--unwrap',
87+
dest='unwrap',
88+
action='store_true',
89+
help='Convert word-wrapped paragraphs into single lines',
90+
default=False)
91+
parser.add_argument('--math',
92+
dest='math',
93+
action='store_true',
94+
help='Convert $ to $$ (for KaTeX processing)',
95+
default=False)
96+
97+
opts = parser.parse_args() # type: Any
9898

9999
def mkdir_p(path):
100100
# type: (str) -> None

0 commit comments

Comments
 (0)