vcpkg/toolsrc/include/vcpkg_Commands.h

72 lines
3.1 KiB
C
Raw Normal View History

2016-09-19 11:50:08 +08:00
#pragma once
#include "vcpkg_cmd_arguments.h"
#include "vcpkg_paths.h"
namespace vcpkg
{
extern const char*const INTEGRATE_COMMAND_HELPSTRING;
void print_usage();
void print_example(const std::string& command_and_arguments);
std::string create_example_string(const std::string& command_and_arguments);
2016-09-19 11:50:08 +08:00
void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
2016-09-19 11:50:08 +08:00
void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void internal_test_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
2016-11-07 12:12:54 +08:00
void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
2016-09-19 11:50:08 +08:00
void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void help_topic_valid_triplet(const vcpkg_paths& paths);
void version_command(const vcpkg_cmd_arguments& args);
void contact_command(const vcpkg_cmd_arguments& args);
2016-10-21 09:05:52 +08:00
void hash_command(const vcpkg_cmd_arguments& args);
2016-09-19 11:50:08 +08:00
using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
using command_type_c = void(*)(const vcpkg_cmd_arguments& args);
template <class T>
struct package_name_and_function
{
std::string name;
T function;
};
const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a();
const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b();
const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c();
template <typename T>
T find_command(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands)
{
for (const package_name_and_function<T>& cmd : available_commands)
{
if (cmd.name == command_name)
{
return cmd.function;
}
}
// not found
return nullptr;
}
}