mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Explain config file dumping
This commit is contained in:
parent
ec3767c545
commit
c88f20859a
@ -81,6 +81,8 @@ def configure_logging_from_config(args: argparse.Namespace, config: Config) -> N
|
|||||||
|
|
||||||
|
|
||||||
def dump_config(args: argparse.Namespace, config: Config) -> None:
|
def dump_config(args: argparse.Namespace, config: Config) -> None:
|
||||||
|
log.explain_topic("Dumping config")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if args.dump_config is True:
|
if args.dump_config is True:
|
||||||
config.dump()
|
config.dump()
|
||||||
|
@ -5,6 +5,8 @@ from configparser import ConfigParser, SectionProxy
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, List, NoReturn, Optional, Tuple
|
from typing import Any, List, NoReturn, Optional, Tuple
|
||||||
|
|
||||||
|
from rich.markup import escape
|
||||||
|
|
||||||
from .logging import log
|
from .logging import log
|
||||||
from .utils import prompt_yes_no
|
from .utils import prompt_yes_no
|
||||||
|
|
||||||
@ -122,10 +124,14 @@ class Config:
|
|||||||
May throw a ConfigDumpError.
|
May throw a ConfigDumpError.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not path:
|
if path:
|
||||||
|
log.explain("Using custom path")
|
||||||
|
else:
|
||||||
|
log.explain("Using default path")
|
||||||
path = self._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:
|
try:
|
||||||
path.parent.mkdir(parents=True, exist_ok=True)
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user