Add ability to use and save options in files (#314)
This commit is contained in:
parent
9c61c73dc4
commit
3f54574eb9
@ -2,3 +2,4 @@ reportlab
|
|||||||
Pillow
|
Pillow
|
||||||
pre-commit
|
pre-commit
|
||||||
pytest
|
pytest
|
||||||
|
configargparse
|
||||||
|
|||||||
@ -8,6 +8,7 @@ aspy.yaml==1.3.0 # via pre-commit
|
|||||||
atomicwrites==1.3.0 # via pytest
|
atomicwrites==1.3.0 # via pytest
|
||||||
attrs==19.3.0 # via pytest
|
attrs==19.3.0 # via pytest
|
||||||
cfgv==2.0.1 # via pre-commit
|
cfgv==2.0.1 # via pre-commit
|
||||||
|
configargparse==1.2
|
||||||
identify==1.4.7 # via pre-commit
|
identify==1.4.7 # via pre-commit
|
||||||
importlib-metadata==0.23 # via pluggy, pre-commit, pytest
|
importlib-metadata==0.23 # via pluggy, pre-commit, pytest
|
||||||
more-itertools==7.2.0 # via pytest, zipp
|
more-itertools==7.2.0 # via pytest, zipp
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import os
|
|||||||
import codecs
|
import codecs
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import configargparse
|
||||||
import copy
|
import copy
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
@ -131,8 +131,8 @@ def add_opt(options, option, value):
|
|||||||
|
|
||||||
|
|
||||||
def parse_opts(cmdline_args=None):
|
def parse_opts(cmdline_args=None):
|
||||||
parser = argparse.ArgumentParser(
|
parser = configargparse.ArgParser(
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
formatter_class=configargparse.ArgumentDefaultsHelpFormatter,
|
||||||
description="Generate Dominion Dividers",
|
description="Generate Dominion Dividers",
|
||||||
epilog="Source can be found at 'https://github.com/sumpfork/dominiontabs'. "
|
epilog="Source can be found at 'https://github.com/sumpfork/dominiontabs'. "
|
||||||
"An online version can be found at 'http://domtabs.sandflea.org/'. ",
|
"An online version can be found at 'http://domtabs.sandflea.org/'. ",
|
||||||
@ -747,6 +747,17 @@ def parse_opts(cmdline_args=None):
|
|||||||
dest="write_json",
|
dest="write_json",
|
||||||
help="Write json version of card definitions and extras.",
|
help="Write json version of card definitions and extras.",
|
||||||
)
|
)
|
||||||
|
group_special.add_argument(
|
||||||
|
"-c",
|
||||||
|
is_config_file=True,
|
||||||
|
help="Use the specified configuration file to provide options. "
|
||||||
|
"Command line options override options from this file.",
|
||||||
|
)
|
||||||
|
group_special.add_argument(
|
||||||
|
"-w",
|
||||||
|
is_write_out_config_file_arg=True,
|
||||||
|
help="Write out the given options to the specified configuration file.",
|
||||||
|
)
|
||||||
|
|
||||||
options = parser.parse_args(args=cmdline_args)
|
options = parser.parse_args(args=cmdline_args)
|
||||||
# Need to do these while we have access to the parser
|
# Need to do these while we have access to the parser
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user