mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 01:24:47 +08:00
Add vcpkg edit --all
This commit is contained in:
parent
410c547fa1
commit
385df0b02b
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user