Add ability to use and save options in files (#314)

This commit is contained in:
Wendel Voigt authored and GitHub committed 2020-04-06 21:15:32 -07:00
1 parent 9c61c73dc4
commit 3f54574eb9
3 files changed
+16 -3

No files matched your search

+14 -3
View File
@@ -2,7 +2,7 @@ import os
import codecs
import json
import sys
import argparse
import configargparse
import copy
import fnmatch
import pkg_resources
@@ -131,8 +131,8 @@ def add_opt(options, option, value):
def parse_opts(cmdline_args=None):
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
parser = configargparse.ArgParser(
formatter_class=configargparse.ArgumentDefaultsHelpFormatter,
description="Generate Dominion Dividers",
epilog="Source can be found at 'https://github.com/sumpfork/dominiontabs'. "
"An online version can be found at 'http://domtabs.sandflea.org/'. ",
@@ -747,6 +747,17 @@ def parse_opts(cmdline_args=None):
dest="write_json",
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)
# Need to do these while we have access to the parser