diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-12-12 15:03:36 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-12-12 15:03:36 -0800 |
| commit | b629cd904440c640b7e5b4c3fdf17df5aac90bad (patch) | |
| tree | f4b1341687cd6166755ea052c31bf9272f09d4e8 /toolsrc/src | |
| parent | d02fe9bdae3553660896d14ef24c2b6dc82bb6db (diff) | |
| download | vcpkg-b629cd904440c640b7e5b4c3fdf17df5aac90bad.tar.gz vcpkg-b629cd904440c640b7e5b4c3fdf17df5aac90bad.zip | |
[vcpkg_cmd_arguments] Use std::string instead of char*
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/commands_cache.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_create.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/commands_edit.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_hash.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/commands_import.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_installation.cpp | 6 | ||||
| -rw-r--r-- | toolsrc/src/commands_integration.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_list.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_owns.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_portsdiff.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/commands_remove.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_search.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_cmd_arguments.cpp | 6 |
13 files changed, 20 insertions, 20 deletions
diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index 19c762caf..f43b054a6 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -38,7 +38,7 @@ namespace vcpkg { 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", create_example_string("cache png")); - args.check_max_arg_count(1, example.c_str()); + args.check_max_arg_count(1, example); const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths); if (binary_paragraphs.empty()) diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index d1611eb5c..ad00cd676 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -9,8 +9,8 @@ namespace vcpkg void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { 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()); + args.check_max_arg_count(3, example); + args.check_min_arg_count(2, example); const std::string port_name = args.command_arguments.at(0); Environment::ensure_utilities_on_path(paths); diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index f07a15875..fbf4eab62 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -7,7 +7,7 @@ namespace vcpkg void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { static const std::string example = create_example_string("edit zlib"); - args.check_exact_arg_count(1, example.c_str()); + args.check_exact_arg_count(1, example); const std::string port_name = args.command_arguments.at(0); const fs::path portpath = paths.ports / port_name; diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp index 17c191b78..42d1823fa 100644 --- a/toolsrc/src/commands_hash.cpp +++ b/toolsrc/src/commands_hash.cpp @@ -27,8 +27,8 @@ namespace vcpkg { static const std::string example = Strings::format( "The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")); - args.check_min_arg_count(1, example.c_str()); - args.check_max_arg_count(2, example.c_str()); + args.check_min_arg_count(1, example); + args.check_max_arg_count(2, example); if (args.command_arguments.size() == 1) { diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/commands_import.cpp index e5e731799..3832f0e7b 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/commands_import.cpp @@ -78,7 +78,7 @@ namespace vcpkg void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { static const std::string example = create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); - args.check_exact_arg_count(3, example.c_str()); + args.check_exact_arg_count(3, example); const fs::path control_file_path(args.command_arguments[0]); const fs::path include_directory(args.command_arguments[1]); diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp index 1abd16796..c376d522f 100644 --- a/toolsrc/src/commands_installation.cpp +++ b/toolsrc/src/commands_installation.cpp @@ -216,7 +216,7 @@ 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()); + args.check_min_arg_count(1, example); StatusParagraphs status_db = database_load_check(paths); std::vector<package_spec> specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example.c_str()); @@ -276,7 +276,7 @@ namespace vcpkg // Installing multiple packages leads to unintuitive behavior if one of them depends on another. // Allowing only 1 package for now. - args.check_exact_arg_count(1, example.c_str()); + args.check_exact_arg_count(1, example); StatusParagraphs status_db = database_load_check(paths); @@ -332,7 +332,7 @@ namespace vcpkg void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { 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()); + args.check_exact_arg_count(2, example); expected<package_spec> maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); if (auto spec = maybe_current_spec.get()) diff --git a/toolsrc/src/commands_integration.cpp b/toolsrc/src/commands_integration.cpp index cd303c649..31f30f216 100644 --- a/toolsrc/src/commands_integration.cpp +++ b/toolsrc/src/commands_integration.cpp @@ -297,7 +297,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console { static const std::string example = Strings::format("Commands:\n" "%s", INTEGRATE_COMMAND_HELPSTRING); - args.check_exact_arg_count(1, example.c_str()); + args.check_exact_arg_count(1, example); if (args.command_arguments[0] == "install") { diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp index 2d6b42008..cc51232e9 100644 --- a/toolsrc/src/commands_list.cpp +++ b/toolsrc/src/commands_list.cpp @@ -17,7 +17,7 @@ namespace vcpkg { 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", create_example_string("list png")); - args.check_max_arg_count(1, example.c_str()); + args.check_max_arg_count(1, example); const StatusParagraphs status_paragraphs = database_load_check(paths); std::vector<StatusParagraph> installed_packages; diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/commands_owns.cpp index 45f073304..62dac57eb 100644 --- a/toolsrc/src/commands_owns.cpp +++ b/toolsrc/src/commands_owns.cpp @@ -24,7 +24,7 @@ namespace vcpkg void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { static const std::string example = Strings::format("The argument should be a pattern to search for. %s", create_example_string("owns zlib.dll")); - args.check_exact_arg_count(1, example.c_str()); + args.check_exact_arg_count(1, example); StatusParagraphs status_db = database_load_check(paths); search_file(paths, args.command_arguments[0], status_db); diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/commands_portsdiff.cpp index b6b604e54..46c6c90c7 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/commands_portsdiff.cpp @@ -100,8 +100,8 @@ namespace vcpkg void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", create_example_string("portsdiff mybranchname")); - args.check_min_arg_count(1, example.c_str()); - args.check_max_arg_count(2, example.c_str()); + args.check_min_arg_count(1, example); + args.check_max_arg_count(2, example); Environment::ensure_git_on_path(paths); const std::wstring git_commit_id_for_previous_snapshot = Strings::utf8_to_utf16(args.command_arguments.at(0)); diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index 31331fc2f..9d3352532 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -169,7 +169,7 @@ namespace vcpkg void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { static const std::string example = create_example_string("remove zlib zlib:x64-windows curl boost"); - args.check_min_arg_count(1, example.c_str()); + args.check_min_arg_count(1, example); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE}); auto status_db = database_load_check(paths); diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp index a604c5383..a4714477e 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/commands_search.cpp @@ -43,7 +43,7 @@ namespace vcpkg void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { 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", create_example_string("search png")); - args.check_max_arg_count(1, example.c_str()); + args.check_max_arg_count(1, example); const std::vector<SourceParagraph> source_paragraphs = read_all_source_paragraphs(paths); diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp index d61e420ab..2cc1f811c 100644 --- a/toolsrc/src/vcpkg_cmd_arguments.cpp +++ b/toolsrc/src/vcpkg_cmd_arguments.cpp @@ -179,7 +179,7 @@ namespace vcpkg return check_exact_arg_count(expected_arg_count, ""); } - void vcpkg_cmd_arguments::check_max_arg_count(const size_t expected_arg_count, const char* example_text) const + void vcpkg_cmd_arguments::check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const { const size_t actual_arg_count = command_arguments.size(); if (actual_arg_count > expected_arg_count) @@ -190,7 +190,7 @@ namespace vcpkg } } - void vcpkg_cmd_arguments::check_min_arg_count(const size_t expected_arg_count, const char* example_text) const + void vcpkg_cmd_arguments::check_min_arg_count(const size_t expected_arg_count, const std::string& example_text) const { const size_t actual_arg_count = command_arguments.size(); if (actual_arg_count < expected_arg_count) @@ -201,7 +201,7 @@ namespace vcpkg } } - void vcpkg_cmd_arguments::check_exact_arg_count(const size_t expected_arg_count, const char* example_text) const + void vcpkg_cmd_arguments::check_exact_arg_count(const size_t expected_arg_count, const std::string& example_text) const { const size_t actual_arg_count = command_arguments.size(); if (actual_arg_count != expected_arg_count) |
