diff options
author | Nico Weber <thakis@chromium.org> | 2013-03-27 23:03:52 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2013-03-27 23:03:52 (GMT) |
commit | 61f4a9905a7e68149a5420617f23d4e73783335c (patch) | |
tree | 2ae0d355965d43c05294c152e56a236662dad82f /src/ninja.cc | |
parent | 543f3edb5c8031aecdf176050065e35101e1992f (diff) | |
download | Ninja-61f4a9905a7e68149a5420617f23d4e73783335c.zip Ninja-61f4a9905a7e68149a5420617f23d4e73783335c.tar.gz Ninja-61f4a9905a7e68149a5420617f23d4e73783335c.tar.bz2 |
Add spell checking for debug flags.
I just used `ninja -d stat` and it took me a bit to realize that I missed the
trailing 's'.
While here, move the message printing from printf() to Error(). This makes the
output consistent with other error outputs: The messages are now prefixed with
"ninja: error: " instead of just "ninja: " and they go to stderr instead of
stdout.
Diffstat (limited to 'src/ninja.cc')
-rw-r--r-- | src/ninja.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index b24ac33..69646e1 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -629,7 +629,14 @@ bool DebugEnable(const string& name, Globals* globals) { g_explaining = true; return true; } else { - printf("ninja: unknown debug setting '%s'\n", name.c_str()); + const char* suggestion = + SpellcheckString(name, "stats", "explain", NULL); + if (suggestion) { + Error("unknown debug setting '%s', did you mean '%s'?", + name.c_str(), suggestion); + } else { + Error("unknown debug setting '%s'", name.c_str()); + } return false; } } |