mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-15 02:38:05 +08:00
[vcpkg] Refactor VcpkgCmdArguments to not utilize global state
This commit is contained in:
parent
e2980c8f91
commit
a2e6ffd86d
@ -79,6 +79,8 @@ namespace vcpkg
|
||||
Optional<bool> sendmetrics = nullopt;
|
||||
Optional<bool> printmetrics = nullopt;
|
||||
|
||||
// feature flags
|
||||
Optional<bool> featurepackages = nullopt;
|
||||
std::string command;
|
||||
std::vector<std::string> command_arguments;
|
||||
|
||||
|
@ -265,6 +265,7 @@ int main(const int argc, const char* const* const argv)
|
||||
|
||||
const VcpkgCmdArguments args = VcpkgCmdArguments::create_from_command_line(argc, argv);
|
||||
|
||||
if (const auto p = args.featurepackages.get()) GlobalState::feature_packages = *p;
|
||||
if (const auto p = args.printmetrics.get()) Metrics::g_metrics.lock()->set_print_metrics(*p);
|
||||
if (const auto p = args.sendmetrics.get()) Metrics::g_metrics.lock()->set_send_metrics(*p);
|
||||
if (const auto p = args.debug.get()) GlobalState::debugging = *p;
|
||||
|
@ -126,12 +126,13 @@ namespace vcpkg
|
||||
}
|
||||
if (arg == "--featurepackages")
|
||||
{
|
||||
GlobalState::feature_packages = true;
|
||||
parse_switch(true, "featurepackages", args.featurepackages);
|
||||
continue;
|
||||
}
|
||||
if (arg == "--no-featurepackages")
|
||||
{
|
||||
GlobalState::feature_packages = false;
|
||||
parse_switch(false, "featurepackages", args.featurepackages);
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user