mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-19 05:10:47 +08:00
0dcc11ac22
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
33 lines
856 B
C++
33 lines
856 B
C++
#pragma once
|
|
|
|
#include <vcpkg/commands.interface.h>
|
|
|
|
namespace vcpkg::Commands
|
|
{
|
|
template<class T>
|
|
struct PackageNameAndFunction
|
|
{
|
|
std::string name;
|
|
T function;
|
|
};
|
|
|
|
Span<const PackageNameAndFunction<const BasicCommand*>> get_available_basic_commands();
|
|
Span<const PackageNameAndFunction<const PathsCommand*>> get_available_paths_commands();
|
|
Span<const PackageNameAndFunction<const TripletCommand*>> get_available_triplet_commands();
|
|
|
|
template<typename T>
|
|
T find(StringView command_name, Span<const PackageNameAndFunction<T>> available_commands)
|
|
{
|
|
for (const PackageNameAndFunction<T>& cmd : available_commands)
|
|
{
|
|
if (cmd.name == command_name)
|
|
{
|
|
return cmd.function;
|
|
}
|
|
}
|
|
|
|
// not found
|
|
return nullptr;
|
|
}
|
|
}
|