aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_help.cpp
diff options
context:
space:
mode:
authorJan HrubĂ˝ <jhruby.web@gmail.com>2017-03-13 08:56:05 +0100
committerGitHub <noreply@github.com>2017-03-13 08:56:05 +0100
commit665f4118f603c5858217ed7a2f2f824b18ff4fc5 (patch)
treef0167041edf71e90f2331b5025f603392a8de67a /toolsrc/src/commands_help.cpp
parent1bec0fcb73073b5b1719f454c368a63f1bff625e (diff)
parent1c9873a0daf625f67474aaf3e163c592c27ecb65 (diff)
downloadvcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.tar.gz
vcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.zip
Merge pull request #1 from Microsoft/master
pull
Diffstat (limited to 'toolsrc/src/commands_help.cpp')
-rw-r--r--toolsrc/src/commands_help.cpp91
1 files changed, 63 insertions, 28 deletions
diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp
index 4e1ae9c49..49b5697c3 100644
--- a/toolsrc/src/commands_help.cpp
+++ b/toolsrc/src/commands_help.cpp
@@ -1,23 +1,74 @@
+#include "pch.h"
#include "vcpkg_Commands.h"
-#include "vcpkg.h"
#include "vcpkg_System.h"
-namespace vcpkg
+namespace vcpkg::Commands::Help
{
- void version_command(const vcpkg_cmd_arguments& args)
+ void help_topic_valid_triplet(const vcpkg_paths& paths)
{
- args.check_max_args(0);
- System::println("Vcpkg package management program version %s\n"
- "\n"
- "Vcpkg is provided \"as-is\" without warranty of any kind, express or implied.\n"
- "All rights reserved.", vcpkg::version()
- );
- exit(EXIT_SUCCESS);
+ System::println("Available architecture triplets:");
+ auto it = fs::directory_iterator(paths.triplets);
+ for (; it != fs::directory_iterator(); ++it)
+ {
+ System::println(" %s", it->path().stem().filename().string());
+ }
+ }
+
+ void print_usage()
+ {
+ System::println(
+ "Commands:\n"
+ " 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"
+ " vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n"
+ "\n"
+ "%s" // Integration help
+ "\n"
+ " vcpkg edit <pkg> Open up a port for editing (uses %%EDITOR%%, default 'code')\n"
+ " 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"
+ "\n"
+ " --vcpkg-root <path> Specify the vcpkg root directory\n"
+ " (default: %%VCPKG_ROOT%%)\n"
+ "\n"
+ "For more help (including examples) see the accompanying README.md."
+ , Integrate::INTEGRATE_COMMAND_HELPSTRING);
+ }
+
+ std::string create_example_string(const std::string& command_and_arguments)
+ {
+ std::string cs = Strings::format("Example:\n"
+ " vcpkg %s", command_and_arguments);
+ return cs;
+ }
+
+ void print_example(const std::string& command_and_arguments)
+ {
+ System::println(create_example_string(command_and_arguments));
}
- void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
+ void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{
- args.check_max_args(1);
+ args.check_max_arg_count(1);
+ args.check_and_get_optional_command_arguments({});
+
if (args.command_arguments.empty())
{
print_usage();
@@ -36,20 +87,4 @@ namespace vcpkg
}
exit(EXIT_SUCCESS);
}
-
- void contact_command(const vcpkg_cmd_arguments& /*args*/)
- {
- System::println("Send an email to vcpkg@microsoft.com with any feedback.");
- exit(EXIT_SUCCESS);
- }
-
- void help_topic_valid_triplet(const vcpkg_paths& paths)
- {
- System::println("Available architecture triplets:");
- auto it = fs::directory_iterator(paths.triplets);
- for (; it != fs::directory_iterator(); ++it)
- {
- System::println(" %s", it->path().stem().filename().string());
- }
- }
}