Suppress full config output of "esphome config" when -q option is used. (#5852)

This commit is contained in:
Clyde Stubbs 2023-12-05 10:52:02 +11:00 committed by GitHub
parent b8fe4f8d56
commit df5394d51c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View file

@ -389,7 +389,8 @@ def command_config(args, config):
output = re.sub(
r"(password|key|psk|ssid)\: (.+)", r"\1: \\033[5m\2\\033[6m", output
)
safe_print(output)
if not CORE.quiet:
safe_print(output)
_LOGGER.info("Configuration is valid!")
return 0

View file

@ -522,6 +522,8 @@ class EsphomeCore:
self.component_ids = set()
# Whether ESPHome was started in verbose mode
self.verbose = False
# Whether ESPHome was started in quiet mode
self.quiet = False
def reset(self):
self.dashboard = False

View file

@ -78,6 +78,7 @@ def setup_log(
CORE.verbose = True
elif quiet:
log_level = logging.CRITICAL
CORE.quiet = True
else:
log_level = logging.INFO
logging.basicConfig(level=log_level)