Skip to content

Commit

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

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

Closes microsoft#13637
  • Loading branch information
pratikpc committed Sep 24, 2020
1 parent 925a3c8 commit 26fd1cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 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 26fd1cc

Please sign in to comment.