fix messages of 'init --dry'

This commit is contained in:
Manuel Barkhau 2019-02-15 20:50:24 +01:00
parent 7239679296
commit a28e508e3c

View file

@ -179,13 +179,13 @@ def init(verbose: int = 0, dry: bool = False) -> None:
cfg: config.MaybeConfig = config.parse(ctx) cfg: config.MaybeConfig = config.parse(ctx)
if cfg: if cfg:
log.error("Configuration already initialized in {ctx.config_filepath}") log.error(f"Configuration already initialized in {ctx.config_filepath}")
sys.exit(1) sys.exit(1)
if dry: if dry:
print("Exiting because of '--dry'. Would have written to {ctx.config_filepath}:") print(f"Exiting because of '--dry'. Would have written to {ctx.config_filepath}:")
cfg_lines = config.default_config(ctx) cfg_text: str = config.default_config(ctx)
print("\n " + "\n ".join(cfg_lines)) print("\n " + "\n ".join(cfg_text.splitlines()))
sys.exit(0) sys.exit(0)
config.write_content(ctx) config.write_content(ctx)