Switch tools/find-add-class from optparse to argparse.

This commit is contained in:
Gordon P. Hemsley 2016-08-28 18:09:05 -04:00 committed by Tim Abbott
parent 9b867be075
commit fc6f72174b
1 changed files with 7 additions and 7 deletions

View File

@ -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)