Add vcpkg edit --all

This commit is contained in:
Alexander Karatarakis 2018-04-03 15:28:47 -07:00
parent 410c547fa1
commit 385df0b02b

View File

@ -34,6 +34,8 @@ namespace vcpkg::Commands::Edit
static constexpr StringLiteral OPTION_BUILDTREES = "--buildtrees"; static constexpr StringLiteral OPTION_BUILDTREES = "--buildtrees";
static constexpr StringLiteral OPTION_ALL = "--all";
static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) static std::vector<std::string> valid_arguments(const VcpkgPaths& paths)
{ {
auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); 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; }); [](auto&& pgh) -> std::string { return pgh->core_paragraph->name; });
} }
static constexpr std::array<CommandSwitch, 1> EDIT_SWITCHES = {{ static constexpr std::array<CommandSwitch, 2> EDIT_SWITCHES = {
{OPTION_BUILDTREES, "Open editor into the port-specific buildtree subfolder"}, {{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 = { const CommandStructure COMMAND_STRUCTURE = {
Help::create_example_string("edit zlib"), 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)); 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( const auto cmd_line = Strings::format(
R"("%s" "%s" "%s" -n)", R"("%s" "%s" "%s" -n)",
env_editor.u8string(), env_editor.u8string(),