Enforce keyword-only args, alphabetize args.
This commit is contained in:
parent
bb72c40c53
commit
d1b42b71cb
1 changed files with 9 additions and 2 deletions
|
@ -30,7 +30,14 @@ site = backend.site
|
||||||
|
|
||||||
HTTPS_DIR = pathclass.Path(__file__).parent.with_child('https')
|
HTTPS_DIR = pathclass.Path(__file__).parent.with_child('https')
|
||||||
|
|
||||||
def ycdl_flask_launch(create, port, localhost_only, refresh_rate, use_https):
|
def ycdl_flask_launch(
|
||||||
|
*,
|
||||||
|
create,
|
||||||
|
localhost_only,
|
||||||
|
port,
|
||||||
|
refresh_rate,
|
||||||
|
use_https,
|
||||||
|
):
|
||||||
if use_https is None:
|
if use_https is None:
|
||||||
use_https = port == 443
|
use_https = port == 443
|
||||||
|
|
||||||
|
@ -85,10 +92,10 @@ def main(argv):
|
||||||
|
|
||||||
parser.add_argument('port', nargs='?', type=int, default=5000)
|
parser.add_argument('port', nargs='?', type=int, default=5000)
|
||||||
parser.add_argument('--dont_create', '--dont-create', '--no-create', dest='create', action='store_false', default=True)
|
parser.add_argument('--dont_create', '--dont-create', '--no-create', dest='create', action='store_false', default=True)
|
||||||
|
parser.add_argument('--https', dest='use_https', action='store_true', default=None)
|
||||||
parser.add_argument('--localhost_only', '--localhost-only', dest='localhost_only', action='store_true')
|
parser.add_argument('--localhost_only', '--localhost-only', dest='localhost_only', action='store_true')
|
||||||
parser.add_argument('--no_refresh', '--no-refresh', dest='do_refresh', action='store_false', default=True)
|
parser.add_argument('--no_refresh', '--no-refresh', dest='do_refresh', action='store_false', default=True)
|
||||||
parser.add_argument('--refresh_rate', '--refresh-rate', dest='refresh_rate', type=int, default=60 * 60 * 6)
|
parser.add_argument('--refresh_rate', '--refresh-rate', dest='refresh_rate', type=int, default=60 * 60 * 6)
|
||||||
parser.add_argument('--https', dest='use_https', action='store_true', default=None)
|
|
||||||
parser.set_defaults(func=ycdl_flask_launch_argparse)
|
parser.set_defaults(func=ycdl_flask_launch_argparse)
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
|
|
Loading…
Reference in a new issue