Rename file

This commit is contained in:
Tim Van Baak 2020-01-01 19:46:05 -08:00
parent bf27d2bdaf
commit 6e22a92b78
3 changed files with 11 additions and 9 deletions

View File

@ -5,7 +5,7 @@ import traceback
# Module imports # Module imports
import cli import cli
import configs import config
def repl(args): def repl(args):
@ -58,7 +58,7 @@ def get_parser(valid_commands):
# The config directory. # The config directory.
parser.add_argument("--config-dir", parser.add_argument("--config-dir",
dest="config_dir", dest="config_dir",
default=os.environ.get(configs.ENV_CONFIG_DIR, "./config"), default=os.environ.get(config.ENV_CONFIG_DIR, "./config"),
help="The config directory for Amanuensis") help="The config directory for Amanuensis")
# Logging settings. # Logging settings.
parser.add_argument("--verbose", "-v", parser.add_argument("--verbose", "-v",
@ -67,15 +67,15 @@ def get_parser(valid_commands):
help="Enable verbose console logging") help="Enable verbose console logging")
parser.add_argument("--log-file", parser.add_argument("--log-file",
dest="log_file", dest="log_file",
default=os.environ.get(configs.ENV_LOG_FILE), default=os.environ.get(config.ENV_LOG_FILE),
help="Enable verbose file logging") help="Enable verbose file logging")
parser.add_argument("--log-file-size", parser.add_argument("--log-file-size",
dest="log_file_size", dest="log_file_size",
default=os.environ.get(configs.ENV_LOG_FILE_SIZE), default=os.environ.get(config.ENV_LOG_FILE_SIZE),
help="Maximum rolling log file size") help="Maximum rolling log file size")
parser.add_argument("--log-file-num", parser.add_argument("--log-file-num",
dest="log_file_num", dest="log_file_num",
default=os.environ.get(configs.ENV_LOG_FILE_NUM), default=os.environ.get(config.ENV_LOG_FILE_NUM),
help="Maximum rolling file count") help="Maximum rolling file count")
# Lexicon settings. # Lexicon settings.
parser.add_argument("-n", parser.add_argument("-n",
@ -93,7 +93,9 @@ def get_parser(valid_commands):
# whether their argument is an ArgumentParser. # whether their argument is an ArgumentParser.
for name, func in valid_commands.items(): for name, func in valid_commands.items():
# Create the subparser, set the docstring as the description. # Create the subparser, set the docstring as the description.
cmd = subp.add_parser(name, description=func.__doc__) cmd = subp.add_parser(name,
description=func.__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
# Delegate subparser setup to the command. # Delegate subparser setup to the command.
func(cmd) func(cmd)
# Store function for later execution. # Store function for later execution.
@ -114,7 +116,7 @@ def main(argv):
# initialized at args.config_dir. Otherwise, initialize configs using # initialized at args.config_dir. Otherwise, initialize configs using
# that directory. # that directory.
if args.command and args.command != "init": if args.command and args.command != "init":
configs.init(args) config.init(args)
# Execute command. # Execute command.
args.func(args) args.func(args)

View File

@ -67,6 +67,6 @@ def command_init(args):
def command_dump(args): def command_dump(args):
"""Dumps the global config or the config for the given lexicon""" """Dumps the global config or the config for the given lexicon"""
import json import json
import configs import config
print(json.dumps(configs.GLOBAL_CONFIG, indent=2)) print(json.dumps(config.GLOBAL_CONFIG, indent=2))