[vcpkg] Show Empty Object on vcpkg --list when used with --x-json (#13667)

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

Closes #13637
This commit is contained in:
Pratik Chowdhury 2020-09-25 00:09:24 +05:30 committed by GitHub
parent 2a9225b422
commit 3031f78ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}