Commit 9e71c94d authored by Eli Ribble's avatar Eli Ribble Committed by Commit Bot

Show error with gn desc when no matches are made

This tells the user that they input a value that matches nothing
so that they know they need to correct the input and try again
rather than showing no output and acting like the command worked
correctly

Bug: 646012
Change-Id: I9e796a4a09216dde8939e4a60b255f8beff0c52b
Reviewed-on: https://chromium-review.googlesource.com/1037910Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Eli Ribble <eliribble@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555188}
parent 7f7b2fb9
...@@ -456,6 +456,12 @@ int RunDesc(const std::vector<std::string>& args) { ...@@ -456,6 +456,12 @@ int RunDesc(const std::vector<std::string>& args) {
bool json = cmdline->GetSwitchValueASCII("format") == "json"; bool json = cmdline->GetSwitchValueASCII("format") == "json";
if (target_matches.empty() && config_matches.empty()) {
OutputString("The input " + args[1] +
" matches no targets, configs or files.\n", DECORATION_YELLOW);
return 1;
}
if (json) { if (json) {
// Convert all targets/configs to JSON, serialize and print them // Convert all targets/configs to JSON, serialize and print them
auto res = std::make_unique<base::DictionaryValue>(); auto res = std::make_unique<base::DictionaryValue>();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment