Explain config file dumping

This commit is contained in:
Joscha 2021-05-23 11:04:50 +02:00
parent ec3767c545
commit c88f20859a
2 changed files with 10 additions and 2 deletions

View File

@ -81,6 +81,8 @@ def configure_logging_from_config(args: argparse.Namespace, config: Config) -> N
def dump_config(args: argparse.Namespace, config: Config) -> None:
log.explain_topic("Dumping config")
try:
if args.dump_config is True:
config.dump()

View File

@ -5,6 +5,8 @@ from configparser import ConfigParser, SectionProxy
from pathlib import Path
from typing import Any, List, NoReturn, Optional, Tuple
from rich.markup import escape
from .logging import log
from .utils import prompt_yes_no
@ -122,10 +124,14 @@ class Config:
May throw a ConfigDumpError.
"""
if not path:
if path:
log.explain("Using custom path")
else:
log.explain("Using default path")
path = self._default_path()
print(f"Dumping config to {path}")
log.explain(f"Dumping to {str(path.absolute())!r}")
log.print(f"[bold bright_cyan]Dumping[/] to {escape(repr(str(path.absolute())))}")
try:
path.parent.mkdir(parents=True, exist_ok=True)