From 34bda91695dc49f3bbd41eb3840fb8dfc7b4cf4d Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Sun, 16 Aug 2020 14:19:43 +0200 Subject: [PATCH] Show warnings if there's nothing to auto-fill --- spacy/cli/init_config.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/spacy/cli/init_config.py b/spacy/cli/init_config.py index aafefd817..5fbd237f8 100644 --- a/spacy/cli/init_config.py +++ b/spacy/cli/init_config.py @@ -88,13 +88,21 @@ def fill_config( nlp, _ = util.load_model_from_config(config, auto_fill=True) except ValueError as e: msg.fail(str(e), exits=1) - msg.good("Auto-filled config with all values") + before = config.to_str() + after = nlp.config.to_str() + if before == after: + msg.warn("Nothing to auto-fill: base config is already complete") + else: + msg.good("Auto-filled config with all values") if diff and not is_stdout: - msg.divider("START CONFIG DIFF") - print("") - print(diff_strings(config.to_str(), nlp.config.to_str())) - msg.divider("END CONFIG DIFF") - print("") + if before == after: + msg.warn("No diff to show: nothing was auto-filled") + else: + msg.divider("START CONFIG DIFF") + print("") + print(diff_strings(before, after)) + msg.divider("END CONFIG DIFF") + print("") save_config(nlp.config, output_file, is_stdout=is_stdout)