Skip to content

Commit

Permalink
[vcpkg edit] Add option --buildtrees
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkaratarakis committed Aug 23, 2017
1 parent 687ea82 commit 57d078e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion toolsrc/src/commands_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ namespace vcpkg::Commands::Edit
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string OPTION_BUILDTREES = "--buildtrees";

auto& fs = paths.get_filesystem();

static const std::string example = Commands::Help::create_example_string("edit zlib");
args.check_exact_arg_count(1, example);
args.check_and_get_optional_command_arguments({});
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_BUILDTREES});
const std::string port_name = args.command_arguments.at(0);

const fs::path portpath = paths.ports / port_name;
Expand Down Expand Up @@ -84,6 +87,14 @@ namespace vcpkg::Commands::Edit
VCPKG_LINE_INFO, "Visual Studio Code was not found and the environment variable EDITOR is not set");
}

if (options.find(OPTION_BUILDTREES) != options.cend())
{
const auto buildtrees_current_dir = paths.buildtrees / port_name;

std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" -n)", env_EDITOR, buildtrees_current_dir.native());
Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmdLine));
}

std::wstring cmdLine = Strings::wformat(
LR"("%s" "%s" "%s" -n)", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native());
Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmdLine));
Expand Down

0 comments on commit 57d078e

Please sign in to comment.