Switch tools/webpack from optparse to argparse.

This commit is contained in:
Gordon P. Hemsley 2016-08-28 19:02:03 -04:00 committed by Tim Abbott
parent aace1c5bc9
commit 0f4148920a
1 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import absolute_import from __future__ import absolute_import
import optparse import argparse
import os import os
import subprocess import subprocess
import sys import sys
@ -23,17 +23,17 @@ def run_watch(port):
subprocess.Popen(['tools/node', 'node_modules/.bin/webpack-dev-server'] + subprocess.Popen(['tools/node', 'node_modules/.bin/webpack-dev-server'] +
['--config', 'tools/webpack.config.js', '--watch-poll', '--port', port]) ['--config', 'tools/webpack.config.js', '--watch-poll', '--port', port])
parser = optparse.OptionParser() parser = argparse.ArgumentParser()
parser.add_option('--watch', parser.add_argument('--watch',
action='store_true', dest='watch', default=False, action='store_true', dest='watch', default=False,
help='watch for changes to source files (for development)') help='watch for changes to source files (for development)')
parser.add_option('--port', parser.add_argument('--port',
action='store', dest='port', action='store', dest='port',
default='9994', help='Set the port for the webpack server to run on') default='9994', help='set the port for the webpack server to run on')
(options, args) = parser.parse_args() args = parser.parse_args()
if options.watch: if args.watch:
run_watch(options.port) run_watch(args.port)
else: else:
run() run()