Skip to content

Commit

Permalink
[vcpkg] Show Empty Object on vcpkg --list when used with --x-json (#1…
Browse files Browse the repository at this point in the history
…3667)

Thanks to @strega-nil for recommending using Json::stringify over my initial idea of simply printing an empty object

Closes #13637
  • Loading branch information
pratikpc authored Sep 24, 2020
1 parent 2a9225b commit 3031f78
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion toolsrc/src/vcpkg/commands.list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ namespace vcpkg::Commands::List

if (installed_ipv.empty())
{
System::print2("No packages are installed. Did you mean `search`?\n");
if (args.output_json())
System::print2(Json::stringify(Json::Object(), {}));
else
System::print2("No packages are installed. Did you mean `search`?\n");
Checks::exit_success(VCPKG_LINE_INFO);
}

Expand Down

0 comments on commit 3031f78

Please sign in to comment.