From c91d8e41b60653b652b11c641f7a5b3d3eab7f6b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 7 Nov 2016 17:31:41 -0800 Subject: Introduce vcpkg_info.h/cpp --- toolsrc/src/commands_help.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolsrc/src/commands_help.cpp') diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index 194e809b1..fd02d948e 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -1,6 +1,6 @@ #include "vcpkg_Commands.h" -#include "vcpkg.h" #include "vcpkg_System.h" +#include "vcpkg_info.h" namespace vcpkg { @@ -9,7 +9,7 @@ namespace vcpkg args.check_exact_arg_count(0); System::println("Vcpkg package management program version %s\n" "\n" - "See LICENSE.txt for license information.", vcpkg::version() + "See LICENSE.txt for license information.", Info::version() ); exit(EXIT_SUCCESS); } @@ -39,7 +39,7 @@ namespace vcpkg void contact_command(const vcpkg_cmd_arguments& args) { args.check_exact_arg_count(0); - System::println("Send an email to vcpkg@microsoft.com with any feedback."); + System::println("Send an email to %s with any feedback.", Info::email()); exit(EXIT_SUCCESS); } -- cgit v1.2.3 From df2a05e8546281135c6ea12430734d74371bcf46 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 17:35:33 -0800 Subject: Introduce Command namespace. Refactoring --- toolsrc/src/commands_help.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'toolsrc/src/commands_help.cpp') diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index fd02d948e..5baec62c7 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -2,7 +2,7 @@ #include "vcpkg_System.h" #include "vcpkg_info.h" -namespace vcpkg +namespace vcpkg::Commands { void version_command(const vcpkg_cmd_arguments& args) { @@ -19,18 +19,18 @@ namespace vcpkg args.check_max_arg_count(1); if (args.command_arguments.empty()) { - print_usage(); + Commands::Helpers::print_usage(); exit(EXIT_SUCCESS); } const auto& topic = args.command_arguments[0]; if (topic == "triplet") { - help_topic_valid_triplet(paths); + Commands::help_topic_valid_triplet(paths); } else { System::println(System::color::error, "Error: unknown topic %s", topic); - print_usage(); + Commands::Helpers::print_usage(); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); -- cgit v1.2.3 From 8e1ed2c9a95fa5b9e0bb0a9849a6e20878696f8c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 17:41:50 -0800 Subject: Place contact and version commands in different cpp files --- toolsrc/src/commands_help.cpp | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'toolsrc/src/commands_help.cpp') diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index 5baec62c7..a0881e64d 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -1,19 +1,8 @@ #include "vcpkg_Commands.h" #include "vcpkg_System.h" -#include "vcpkg_info.h" namespace vcpkg::Commands { - void version_command(const vcpkg_cmd_arguments& args) - { - args.check_exact_arg_count(0); - System::println("Vcpkg package management program version %s\n" - "\n" - "See LICENSE.txt for license information.", Info::version() - ); - exit(EXIT_SUCCESS); - } - void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { args.check_max_arg_count(1); @@ -36,13 +25,6 @@ namespace vcpkg::Commands exit(EXIT_SUCCESS); } - void contact_command(const vcpkg_cmd_arguments& args) - { - args.check_exact_arg_count(0); - System::println("Send an email to %s with any feedback.", Info::email()); - exit(EXIT_SUCCESS); - } - void help_topic_valid_triplet(const vcpkg_paths& paths) { System::println("Available architecture triplets:"); -- cgit v1.2.3 From cc8851144a871931b93d84bd962364159ad1c424 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 22:03:57 -0800 Subject: Reorganize commands, each in its own namespace Additionally, functions related to a command can now live in the same namespace --- toolsrc/src/commands_help.cpp | 80 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 15 deletions(-) (limited to 'toolsrc/src/commands_help.cpp') diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index a0881e64d..e4769752c 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -1,37 +1,87 @@ #include "vcpkg_Commands.h" #include "vcpkg_System.h" -namespace vcpkg::Commands +namespace vcpkg::Commands::Help { - void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + 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()); + } + } + + void print_usage() + { + System::println( + "Commands:\n" + " vcpkg search [pat] Search for packages available to be built\n" + " vcpkg install Install a package\n" + " vcpkg remove Uninstall a package. \n" + " vcpkg remove --purge Uninstall and delete a package. \n" + " vcpkg list List installed packages\n" + " vcpkg update Display list of packages for updating\n" + " vcpkg hash [alg] Hash a file by specific algorithm, default SHA512\n" + "\n" + "%s" // Integration help + "\n" + " vcpkg edit Open up a port for editing (uses %%EDITOR%%, default 'code')\n" + " vcpkg import Import a pre-built library\n" + " vcpkg create \n" + " [archivename] Create a new package\n" + " vcpkg owns 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 \n" + //" --create-binary-control \n" + //"\n" + "Options:\n" + " --triplet Specify the target architecture triplet.\n" + " (default: %%VCPKG_DEFAULT_TRIPLET%%, see 'vcpkg help triplet')\n" + "\n" + " --vcpkg-root 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 perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { args.check_max_arg_count(1); if (args.command_arguments.empty()) { - Commands::Helpers::print_usage(); + print_usage(); exit(EXIT_SUCCESS); } const auto& topic = args.command_arguments[0]; if (topic == "triplet") { - Commands::help_topic_valid_triplet(paths); + help_topic_valid_triplet(paths); } else { System::println(System::color::error, "Error: unknown topic %s", topic); - Commands::Helpers::print_usage(); + print_usage(); exit(EXIT_FAILURE); } 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()); - } - } } -- cgit v1.2.3 From 050e4a0f7a8156bd862f95c06ea298ab6697e147 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 12:49:09 -0800 Subject: Introduce precompiled headers --- toolsrc/src/commands_help.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/src/commands_help.cpp') diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index e4769752c..6068c22fb 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -- cgit v1.2.3