[vcpkg-contact] Add --survey so users can easily provide feedback
MODIFY
include/vcpkg/base/util.h
include/vcpkg/base/util.h
@@ -24,8 +24,8 @@ namespace vcpkg::Util
namespace Sets
{
- template<class Container, class T = ElementT<Container>>
- bool contains(const Container& container, const T& item)
+ template<class Container>
+ bool contains(const Container& container, const ElementT<Container>& item)
{
return container.find(item) != container.cend();
}

MODIFY
src/vcpkg/commands.contact.cpp
src/vcpkg/commands.contact.cpp
@@ -12,19 +12,29 @@ namespace vcpkg::Commands::Contact
return S_EMAIL;
}
+ static const CommandSwitch switches[] = {{"--survey", "Launch default browser to the current vcpkg survey"}};
+
const CommandStructure COMMAND_STRUCTURE = {
Help::create_example_string("contact"),
0,
0,
- {},
+ {switches, {}},
nullptr,
};
void perform_and_exit(const VcpkgCmdArguments& args)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ auto parsed_args = args.parse_arguments(COMMAND_STRUCTURE);
+ if (Util::Sets::contains(parsed_args.switches, switches[0].name))
+ {
+ System::cmd_execute("start https://aka.ms/NPS_vcpkg");
+ System::println("Default browser launched to https://aka.ms/NPS_vcpkg, thank you for your feedback!");
+ }
+ else
+ {
System::println("Send an email to %s with any feedback.", email());
+ }
Checks::exit_success(VCPKG_LINE_INFO);
}
}

[vcpkg-contact] Add --survey so users can easily provide feedback