example -> EXAMPLE

This commit is contained in:
Alexander Karatarakis 2017-08-31 18:05:58 -07:00
parent b72c904719
commit 81c9445376
15 changed files with 43 additions and 44 deletions

View File

@ -89,11 +89,11 @@ namespace vcpkg::Commands::BuildCommand
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows");
args.check_exact_arg_count(
1, example); // Build only takes a single package and all dependencies must already be installed
static const std::string EXAMPLE = Commands::Help::create_example_string("build zlib:x64-windows");
// Build only takes a single package and all dependencies must already be installed
args.check_exact_arg_count(1, EXAMPLE);
const std::string command_argument = args.command_arguments.at(0);
const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, example);
const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE);
Input::check_triplet(spec.package_spec.triplet(), paths);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY});

View File

@ -2,17 +2,16 @@
#include "vcpkg_Commands.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
namespace vcpkg::Commands::BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string example =
static const std::string EXAMPLE =
Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
args.check_exact_arg_count(2, example);
args.check_exact_arg_count(2, EXAMPLE);
const FullPackageSpec spec =
Input::check_and_get_full_package_spec(args.command_arguments.at(0), default_triplet, example);
Input::check_and_get_full_package_spec(args.command_arguments.at(0), default_triplet, EXAMPLE);
Input::check_triplet(spec.package_spec.triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({});

View File

@ -27,10 +27,10 @@ namespace vcpkg::Commands::Cache
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Strings::format(
static const std::string EXAMPLE = Strings::format(
"The argument should be a substring to search for, or no argument to display all cached libraries.\n%s",
Commands::Help::create_example_string("cache png"));
args.check_max_arg_count(1, example);
args.check_max_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});
const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths);

View File

@ -13,9 +13,9 @@
namespace vcpkg::Commands::CI
{
using Build::BuildResult;
using Dependencies::InstallPlanAction;
using Dependencies::InstallPlanType;
using Build::BuildResult;
static std::vector<PackageSpec> load_all_package_specs(Files::Filesystem& fs,
const fs::path& ports_directory,
@ -30,8 +30,8 @@ namespace vcpkg::Commands::CI
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string example = Commands::Help::create_example_string("ci x64-windows");
args.check_max_arg_count(1, example);
static const std::string EXAMPLE = Commands::Help::create_example_string("ci x64-windows");
args.check_max_arg_count(1, EXAMPLE);
const Triplet triplet = args.command_arguments.size() == 1
? Triplet::from_canonical_name(args.command_arguments.at(0))
: default_triplet;

View File

@ -10,10 +10,10 @@ namespace vcpkg::Commands::Create
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Commands::Help::create_example_string(
static const std::string EXAMPLE = Commands::Help::create_example_string(
R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###");
args.check_max_arg_count(3, example);
args.check_min_arg_count(2, example);
args.check_max_arg_count(3, EXAMPLE);
args.check_min_arg_count(2, EXAMPLE);
args.check_and_get_optional_command_arguments({});
const std::string port_name = args.command_arguments.at(0);
const std::string url = args.command_arguments.at(1);

View File

@ -10,8 +10,8 @@ namespace vcpkg::Commands::DependInfo
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Commands::Help::create_example_string(R"###(depend-info [pat])###");
args.check_max_arg_count(1, example);
static const std::string EXAMPLE = Commands::Help::create_example_string(R"###(depend-info [pat])###");
args.check_max_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});
std::vector<std::unique_ptr<SourceControlFile>> source_control_files =

View File

@ -221,12 +221,12 @@ namespace vcpkg::Commands::Export
static const std::string OPTION_NUGET_VERSION = "--nuget-version";
// input sanitization
static const std::string example =
static const std::string EXAMPLE =
Commands::Help::create_example_string("export zlib zlib:x64-windows boost --nuget");
args.check_min_arg_count(1, example);
args.check_min_arg_count(1, EXAMPLE);
const std::vector<PackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
return Input::check_and_get_package_spec(arg, default_triplet, example);
return Input::check_and_get_package_spec(arg, default_triplet, EXAMPLE);
});
for (auto&& spec : specs)
Input::check_triplet(spec.triplet(), paths);
@ -252,7 +252,7 @@ namespace vcpkg::Commands::Export
if (!raw && !nuget && !zip && !_7zip && !dryRun)
{
System::println(System::Color::error, "Must provide at least one export type: --raw --nuget --zip --7zip");
System::print(example);
System::print(EXAMPLE);
Checks::exit_fail(VCPKG_LINE_INFO);
}

View File

@ -93,9 +93,9 @@ namespace vcpkg::Commands::Import
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Commands::Help::create_example_string(
static const std::string EXAMPLE = Commands::Help::create_example_string(
R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)");
args.check_exact_arg_count(3, example);
args.check_exact_arg_count(3, EXAMPLE);
args.check_and_get_optional_command_arguments({});
const fs::path control_file_path(args.command_arguments[0]);

View File

@ -450,12 +450,12 @@ namespace vcpkg::Commands::Install
static const std::string OPTION_RECURSE = "--recurse";
// input sanitization
static const std::string example =
static const std::string EXAMPLE =
Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost");
args.check_min_arg_count(1, example);
args.check_min_arg_count(1, EXAMPLE);
const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
return Input::check_and_get_full_package_spec(arg, default_triplet, example);
return Input::check_and_get_full_package_spec(arg, default_triplet, EXAMPLE);
});
for (auto&& spec : specs)
@ -549,7 +549,7 @@ namespace vcpkg::Commands::Install
{
// User specified --purge and --no-purge
System::println(System::Color::error, "Error: cannot specify both --no-purge and --purge.");
System::print(example);
System::print(EXAMPLE);
Checks::exit_fail(VCPKG_LINE_INFO);
}
const std::string display_name = remove_action->spec.to_string();

View File

@ -317,10 +317,10 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Strings::format("Commands:\n"
static const std::string EXAMPLE = Strings::format("Commands:\n"
"%s",
INTEGRATE_COMMAND_HELPSTRING);
args.check_exact_arg_count(1, example);
args.check_exact_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});
if (args.command_arguments[0] == "install")

View File

@ -25,10 +25,10 @@ namespace vcpkg::Commands::List
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Strings::format(
static const std::string EXAMPLE = Strings::format(
"The argument should be a substring to search for, or no argument to display all installed libraries.\n%s",
Commands::Help::create_example_string("list png"));
args.check_max_arg_count(1, example);
args.check_max_arg_count(1, EXAMPLE);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_FULLDESC});

View File

@ -25,9 +25,9 @@ namespace vcpkg::Commands::Owns
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Strings::format("The argument should be a pattern to search for. %s",
static const std::string EXAMPLE = Strings::format("The argument should be a pattern to search for. %s",
Commands::Help::create_example_string("owns zlib.dll"));
args.check_exact_arg_count(1, example);
args.check_exact_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});
StatusParagraphs status_db = database_load_check(paths);

View File

@ -117,11 +117,11 @@ namespace vcpkg::Commands::PortsDiff
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example =
static const std::string EXAMPLE =
Strings::format("The argument should be a branch/tag/hash to checkout.\n%s",
Commands::Help::create_example_string("portsdiff mybranchname"));
args.check_min_arg_count(1, example);
args.check_max_arg_count(2, example);
args.check_min_arg_count(1, EXAMPLE);
args.check_max_arg_count(2, EXAMPLE);
args.check_and_get_optional_command_arguments({});
const fs::path& git_exe = paths.get_git_exe();

View File

@ -136,7 +136,7 @@ namespace vcpkg::Commands::Remove
static const std::string OPTION_RECURSE = "--recurse";
static const std::string OPTION_DRY_RUN = "--dry-run";
static const std::string OPTION_OUTDATED = "--outdated";
static const std::string example =
static const std::string EXAMPLE =
Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost");
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments(
{OPTION_PURGE, OPTION_NO_PURGE, OPTION_RECURSE, OPTION_DRY_RUN, OPTION_OUTDATED});
@ -145,7 +145,7 @@ namespace vcpkg::Commands::Remove
std::vector<PackageSpec> specs;
if (options.find(OPTION_OUTDATED) != options.cend())
{
args.check_exact_arg_count(0, example);
args.check_exact_arg_count(0, EXAMPLE);
specs = Util::fmap(Update::find_outdated_packages(paths, status_db),
[](auto&& outdated) { return outdated.spec; });
@ -157,9 +157,9 @@ namespace vcpkg::Commands::Remove
}
else
{
args.check_min_arg_count(1, example);
args.check_min_arg_count(1, EXAMPLE);
specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
return Input::check_and_get_package_spec(arg, default_triplet, example);
return Input::check_and_get_package_spec(arg, default_triplet, EXAMPLE);
});
for (auto&& spec : specs)
@ -171,7 +171,7 @@ namespace vcpkg::Commands::Remove
{
// User specified --purge and --no-purge
System::println(System::Color::error, "Error: cannot specify both --no-purge and --purge.");
System::print(example);
System::print(EXAMPLE);
Checks::exit_fail(VCPKG_LINE_INFO);
}
const bool isRecursive = options.find(OPTION_RECURSE) != options.cend();

View File

@ -80,10 +80,10 @@ namespace vcpkg::Commands::Search
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string example = Strings::format(
static const std::string EXAMPLE = Strings::format(
"The argument should be a substring to search for, or no argument to display all libraries.\n%s",
Commands::Help::create_example_string("search png"));
args.check_max_arg_count(1, example);
args.check_max_arg_count(1, EXAMPLE);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_GRAPH, OPTION_FULLDESC});