diff options
Diffstat (limited to 'toolsrc/src/commands_installation.cpp')
| -rw-r--r-- | toolsrc/src/commands_installation.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp index 2890184fb..9eacfedcc 100644 --- a/toolsrc/src/commands_installation.cpp +++ b/toolsrc/src/commands_installation.cpp @@ -65,9 +65,11 @@ namespace vcpkg void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { + static const std::string example = create_example_string("install zlib zlib:x64-windows curl boost"); + args.check_min_arg_count(1, example.c_str()); StatusParagraphs status_db = database_load_check(paths); - std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet); + std::vector<package_spec> specs = vcpkg_cmd_arguments::check_and_get_package_specs(args.command_arguments, default_target_triplet, example.c_str()); std::vector<package_spec> install_plan = Dependencies::create_dependency_ordered_install_plan(paths, specs, status_db); Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); std::string specs_string = to_string(install_plan[0]); @@ -120,13 +122,15 @@ namespace vcpkg void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { + static const std::string example = create_example_string("build zlib:x64-windows"); + // Installing multiple packages leads to unintuitive behavior if one of them depends on another. - // Allowing only 1 package for now. - args.check_max_args(1); + // Allowing only 1 package for now. + args.check_exact_arg_count(1, example.c_str()); StatusParagraphs status_db = database_load_check(paths); - const package_spec spec = args.parse_all_arguments_as_package_specs(default_target_triplet).at(0); + const package_spec spec = vcpkg_cmd_arguments::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example.c_str()); std::unordered_set<package_spec> unmet_dependencies = Dependencies::find_unmet_dependencies(paths, spec, status_db); if (!unmet_dependencies.empty()) { @@ -148,12 +152,8 @@ namespace vcpkg void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { - if (args.command_arguments.size() != 2) - { - System::println(System::color::error, "Error: buildexternal requires the package name and the directory containing the CONTROL file"); - print_example(R"(buildexternal mylib C:\path\to\mylib\)"); - exit(EXIT_FAILURE); - } + static const std::string example = create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); + args.check_exact_arg_count(2, example.c_str()); expected<package_spec> current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); if (auto spec = current_spec.get()) |
