From fc1e55173b23afeb46142e6d656043a4b6f4b21c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 30 Sep 2016 11:24:04 -0700 Subject: Rename check_max_args to check_max_arg_count and introduce min/exact variants --- toolsrc/src/commands_create.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index 85b98d667..2292581ee 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -7,7 +7,7 @@ namespace vcpkg { void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { - args.check_max_args(3); + args.check_max_arg_count(3); if (args.command_arguments.size() < 2) { System::println(System::color::error, "Error: create requires the archive's URL as the second argument."); -- cgit v1.2.3 From b2c1076aef280e7ebfd38845dfcb4d4b66cd45e3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 30 Sep 2016 11:24:04 -0700 Subject: All commands now use the new functions for argument checking --- toolsrc/src/commands_create.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index 2292581ee..d365dac70 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -7,13 +7,9 @@ namespace vcpkg { void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { - args.check_max_arg_count(3); - if (args.command_arguments.size() < 2) - { - System::println(System::color::error, "Error: create requires the archive's URL as the second argument."); - print_usage(); - exit(EXIT_FAILURE); - } + static const std::string example = create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); + args.check_max_arg_count(3, example.c_str()); + args.check_min_arg_count(2, example.c_str()); expected current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); if (const package_spec* spec = current_spec.get()) -- cgit v1.2.3