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