Add vcpkg edit --all
MODIFY
src/vcpkg/commands.edit.cpp
src/vcpkg/commands.edit.cpp
@@ -34,6 +34,8 @@ namespace vcpkg::Commands::Edit
static constexpr StringLiteral OPTION_BUILDTREES = "--buildtrees";
+ static constexpr StringLiteral OPTION_ALL = "--all";
+
static std::vector<std::string> valid_arguments(const VcpkgPaths& paths)
{
auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports);
@@ -42,9 +44,9 @@ namespace vcpkg::Commands::Edit
[](auto&& pgh) -> std::string { return pgh->core_paragraph->name; });
}
- static constexpr std::array<CommandSwitch, 1> EDIT_SWITCHES = {{
- {OPTION_BUILDTREES, "Open editor into the port-specific buildtree subfolder"},
- }};
+ static constexpr std::array<CommandSwitch, 2> EDIT_SWITCHES = {
+ {{OPTION_BUILDTREES, "Open editor into the port-specific buildtree subfolder"},
+ {OPTION_ALL, "Open editor into the port as well as the port-specific buildtree subfolder"}}};
const CommandStructure COMMAND_STRUCTURE = {
Help::create_example_string("edit zlib"),
@@ -113,6 +115,15 @@ namespace vcpkg::Commands::Edit
Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmd_line));
}
+ if (Util::Sets::contains(options.switches, OPTION_ALL))
+ {
+ const auto buildtrees_current_dir = paths.buildtrees / port_name;
+
+ const auto cmd_line = Strings::format(
+ R"("%s" "%s" %s -n)", env_editor.u8string(), portpath.u8string(), buildtrees_current_dir.u8string());
+ Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmd_line));
+ }
+
const auto cmd_line = Strings::format(
R"("%s" "%s" "%s" -n)",
env_editor.u8string(),

Add vcpkg edit --all