vcpkg/toolsrc/src/commands_other.cpp

104 lines
4.2 KiB
C++
Raw Normal View History

2016-09-19 11:50:08 +08:00
#include "vcpkg_Commands.h"
2016-09-22 16:24:26 +08:00
#include "vcpkg_System.h"
2016-09-19 11:50:08 +08:00
namespace vcpkg
{
void print_usage()
{
2016-09-22 16:24:26 +08:00
System::println(
"Commands:\n"
2016-09-19 11:50:08 +08:00
" vcpkg search [pat] Search for packages available to be built\n"
" vcpkg install <pkg> Install a package\n"
" vcpkg remove <pkg> Uninstall a package. \n"
" vcpkg remove --purge <pkg> Uninstall and delete a package. \n"
" vcpkg list List installed packages\n"
" vcpkg update Display list of packages for updating\n"
2016-10-21 09:05:52 +08:00
" vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n"
2016-09-19 11:50:08 +08:00
"\n"
2016-09-22 16:24:26 +08:00
"%s" // Integration help
2016-09-19 11:50:08 +08:00
"\n"
2016-09-22 16:24:26 +08:00
" vcpkg edit <pkg> Open up a port for editing (uses %%EDITOR%%, default 'code')\n"
2016-09-19 11:50:08 +08:00
" vcpkg import <pkg> Import a pre-built library\n"
" vcpkg create <pkg> <url>\n"
" [archivename] Create a new package\n"
" vcpkg owns <pat> Search for files in installed packages\n"
" vcpkg cache List cached compiled packages\n"
" vcpkg version Display version information\n"
" vcpkg contact Display contact information to send feedback\n"
"\n"
//"internal commands:\n"
//" --check-build-deps <controlfile>\n"
//" --create-binary-control <controlfile>\n"
//"\n"
"Options:\n"
" --triplet <t> Specify the target architecture triplet.\n"
" (default: %%VCPKG_DEFAULT_TRIPLET%%, see 'vcpkg help triplet')\n"
2016-09-19 11:50:08 +08:00
"\n"
" --vcpkg-root <path> Specify the vcpkg root directory\n"
2016-09-22 16:24:26 +08:00
" (default: %%VCPKG_ROOT%%)\n"
2016-09-19 11:50:08 +08:00
"\n"
"For more help (including examples) see the accompanying README.md."
2016-09-22 16:24:26 +08:00
, INTEGRATE_COMMAND_HELPSTRING);
2016-09-19 11:50:08 +08:00
}
std::string create_example_string(const std::string& command_and_arguments)
2016-10-01 02:23:05 +08:00
{
std::string cs = Strings::format("Example:\n"
" vcpkg %s", command_and_arguments);
return cs;
2016-10-01 02:23:05 +08:00
}
void print_example(const std::string& command_and_arguments)
2016-09-19 11:50:08 +08:00
{
System::println(create_example_string(command_and_arguments));
2016-09-19 11:50:08 +08:00
}
void internal_test_command(const vcpkg_cmd_arguments& /*args*/, const vcpkg_paths& /*paths*/)
{
// auto data = FormatEventData("test");
// Track(data);
exit(EXIT_SUCCESS);
}
const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a()
{
static std::vector<package_name_and_function<command_type_a>> t = {
{"install", install_command},
{"remove", remove_command},
{"build", build_command},
{"build_external", build_external_command}
};
return t;
}
const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b()
{
static std::vector<package_name_and_function<command_type_b>> t = {
{"/?", help_command},
2016-09-19 11:50:08 +08:00
{"help", help_command},
{"search", search_command},
{"list", list_command},
{"integrate", integrate_command},
{"owns", owns_command},
{"update", update_command},
{"edit", edit_command},
{"create", create_command},
2016-09-19 11:50:08 +08:00
{"import", import_command},
{"cache", cache_command},
{"internal_test", internal_test_command},
2016-11-07 12:12:54 +08:00
{"portsdiff", portsdiff_command}
2016-09-19 11:50:08 +08:00
};
return t;
}
const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c()
{
static std::vector<package_name_and_function<command_type_c>> t = {
{"version", &version_command},
2016-10-21 09:05:52 +08:00
{"contact", &contact_command},
{"hash", &hash_command},
2016-09-19 11:50:08 +08:00
};
return t;
}
}