mirror of https://github.com/zulip/zulip.git
Switch tools/find-add-class from optparse to argparse.
This commit is contained in:
parent
9b867be075
commit
fc6f72174b
|
@ -4,7 +4,7 @@ from __future__ import print_function
|
||||||
|
|
||||||
from lib.find_add_class import display, find
|
from lib.find_add_class import display, find
|
||||||
import glob
|
import glob
|
||||||
import optparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six.moves import filter
|
from six.moves import filter
|
||||||
|
@ -20,7 +20,7 @@ except ImportError as e:
|
||||||
def process_files():
|
def process_files():
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
|
||||||
usage = '''
|
description = '''
|
||||||
Use this tool to find HTML classes that we use in our JS code.
|
Use this tool to find HTML classes that we use in our JS code.
|
||||||
This looks for calls to addClass, and if you use the -v option,
|
This looks for calls to addClass, and if you use the -v option,
|
||||||
you will get a display of (fn, html_class) tuples that
|
you will get a display of (fn, html_class) tuples that
|
||||||
|
@ -31,14 +31,14 @@ def process_files():
|
||||||
call.
|
call.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage=usage)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_option('--verbose', '-v',
|
parser.add_argument('-v', '--verbose',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help='Show where calls are.')
|
help='show where calls are')
|
||||||
(options, _) = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
fns = glob.glob('static/js/*.js')
|
fns = glob.glob('static/js/*.js')
|
||||||
if options.verbose:
|
if args.verbose:
|
||||||
display(fns)
|
display(fns)
|
||||||
else:
|
else:
|
||||||
find(fns)
|
find(fns)
|
||||||
|
|
Loading…
Reference in New Issue