Add "use" CE command.
MODIFY
include/vcpkg/commands.activate.h
include/vcpkg/commands.activate.h
#include <vcpkg/commands.interface.h>
-namespace vcpkg::Commands::Activate
+namespace vcpkg::Commands
{
struct ActivateCommand : PathsCommand
{

ADD
include/vcpkg/commands.use.h
+#pragma once
+
+#include <vcpkg/commands.interface.h>
+
+namespace vcpkg::Commands
+{
+ struct UseCommand : PathsCommand
+ {
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) const override;
+ };
+}

MODIFY
src/vcpkg/commands.activate.cpp
src/vcpkg/commands.activate.cpp
#include <vcpkg/commands.activate.h>
#include <vcpkg/configure-environment.h>
-#include <vcpkg/tools.h>
#include <vcpkg/vcpkgcmdarguments.h>
-namespace vcpkg::Commands::Activate
+namespace vcpkg::Commands
{
void ActivateCommand::perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) const
{

MODIFY
src/vcpkg/commands.cpp
src/vcpkg/commands.cpp
#include <vcpkg/commands.setinstalled.h>
#include <vcpkg/commands.upgrade.h>
#include <vcpkg/commands.upload-metrics.h>
+#include <vcpkg/commands.use.h>
#include <vcpkg/commands.version.h>
#include <vcpkg/commands.xdownload.h>
#include <vcpkg/commands.xvsinstances.h>
@@ -77,7 +78,7 @@ namespace vcpkg::Commands
Span<const PackageNameAndFunction<const PathsCommand*>> get_available_paths_commands()
{
- static const Activate::ActivateCommand activate{};
+ static const ActivateCommand activate{};
static const AddCommand add{};
static const AddVersion::AddVersionCommand add_version{};
static const Autocomplete::AutocompleteCommand autocomplete{};
@@ -98,6 +99,7 @@ namespace vcpkg::Commands
static const PortsDiff::PortsDiffCommand portsdiff{};
static const Search::SearchCommand search{};
static const Update::UpdateCommand update{};
+ static const UseCommand use{};
static const X_VSInstances::VSInstancesCommand vsinstances{};
static const ZCeCommand ce{};
@@ -119,6 +121,7 @@ namespace vcpkg::Commands
{"portsdiff", &portsdiff},
{"search", &search},
{"update", &update},
+ {"use", &use},
{"x-add-version", &add_version},
{"x-ci-clean", &ciclean},
{"x-ci-verify-versions", &ci_verify_versions},

ADD
src/vcpkg/commands.use.cpp
+#include <vcpkg/base/basic_checks.h>
+
+#include <vcpkg/commands.use.h>
+#include <vcpkg/configure-environment.h>
+#include <vcpkg/vcpkgcmdarguments.h>
+
+namespace vcpkg::Commands
+{
+ void UseCommand::perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) const
+ {
+ Checks::exit_with_code(VCPKG_LINE_INFO,
+ run_configure_environment_command(paths, "use", args.get_forwardable_arguments()));
+ }
+}

Add "use" CE command.