mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-21 12:20:40 +00:00
fix: replace log by message for yes/no prompt (#606)
This commit is contained in:
parent
dfa10dd209
commit
0db500b0a8
@ -85,10 +85,12 @@ class Generator:
|
||||
and not self.config.config["dry_run"]
|
||||
):
|
||||
files_to_overwite_string = "\n".join(files_to_overwite)
|
||||
self.logger.warning(f"This files will be overwritten:\n{files_to_overwite_string}")
|
||||
prompt = f"These files will be overwritten:\n{files_to_overwite_string}".replace(
|
||||
"\n", "\n... "
|
||||
)
|
||||
|
||||
try:
|
||||
if not FileUtils.query_yes_no("Do you want to continue?"):
|
||||
if not FileUtils.query_yes_no(f"{prompt}\nDo you want to continue?"):
|
||||
self.log.sysexit_with_message("Aborted...")
|
||||
except ansibledoctor.exception.InputError as e:
|
||||
self.logger.debug(str(e))
|
||||
|
@ -129,7 +129,7 @@ class MultilineFormatter(logging.Formatter):
|
||||
"""Reset color after newline characters."""
|
||||
|
||||
def format(self, record): # noqa
|
||||
record.msg = record.msg.replace("\n", f"\n{colorama.Style.RESET_ALL}... ")
|
||||
record.msg = record.msg.strip().replace("\n", f"\n{colorama.Style.RESET_ALL}... ")
|
||||
return logging.Formatter.format(self, record)
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ class Log:
|
||||
handler.addFilter(LogFilter(logging.DEBUG))
|
||||
handler.setFormatter(
|
||||
MultilineFormatter(
|
||||
self.critical(
|
||||
self.debug(
|
||||
CONSOLE_FORMAT.format(
|
||||
colorama.Fore.BLUE, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user