Introduce `vcpkg depend-info` command
MODIFY
include/vcpkg_Commands.h
include/vcpkg_Commands.h
@@ -86,6 +86,11 @@ namespace vcpkg::Commands
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
+ namespace DependInfo
+ {
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
+ }
+
namespace Search
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);

MODIFY
src/commands_available_commands.cpp
src/commands_available_commands.cpp
@@ -26,6 +26,7 @@ namespace vcpkg::Commands
{"integrate", &Integrate::perform_and_exit},
{"owns", &Owns::perform_and_exit},
{"update", &Update::perform_and_exit},
+ {"depend-info", &DependInfo::perform_and_exit},
{"edit", &Edit::perform_and_exit},
{"create", &Create::perform_and_exit},
{"import", &Import::perform_and_exit},

ADD
src/commands_depends.cpp
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "Paragraphs.h"
+#include "vcpkg_Strings.h"
+
+namespace vcpkg::Commands::DependInfo
+{
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
+ {
+ static const std::string example = Commands::Help::create_example_string(R"###(depend-info)###");
+ args.check_exact_arg_count(0, example);
+ args.check_and_get_optional_command_arguments({});
+
+ const std::vector<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(paths.ports);
+
+ for (const SourceParagraph& source_paragraph : source_paragraphs)
+ {
+ auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name; });
+ System::println("%s: %s", source_paragraph.name, s);
+ }
+
+ Checks::exit_success(VCPKG_LINE_INFO);
+ }
+}

MODIFY
vcpkglib/vcpkglib.vcxproj
vcpkglib/vcpkglib.vcxproj
<ClCompile Include="..\include\VersionT.cpp" />
<ClCompile Include="..\src\BinaryParagraph.cpp" />
<ClCompile Include="..\src\commands_ci.cpp" />
+ <ClCompile Include="..\src\commands_depends.cpp" />
<ClCompile Include="..\src\commands_env.cpp" />
<ClCompile Include="..\src\LineInfo.cpp" />
<ClCompile Include="..\src\ParagraphParseResult.cpp" />

MODIFY
vcpkglib/vcpkglib.vcxproj.filters
vcpkglib/vcpkglib.vcxproj.filters
<ClCompile Include="..\src\VcpkgPaths.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\commands_depends.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\SourceParagraph.h">

Introduce `vcpkg depend-info` command