소스 검색

cmake_file_api: Improve error message consistency

Remove literal text "subcommand" from error messages. This addresses the
other use of this and improves consistency (see preceding commit). Also,
omit some unnecessary articles, which also improves consistency.
Matthew Woehlke 4 달 전
부모
커밋
a1a75f4008
2개의 변경된 파일11개의 추가작업 그리고 12개의 파일을 삭제
  1. 5 6
      Source/cmFileAPICommand.cxx
  2. 6 6
      Tests/RunCMake/FileAPI/ProjectQueryBad-stderr.txt

+ 5 - 6
Source/cmFileAPICommand.cxx

@@ -68,7 +68,7 @@ bool handleQueryCommand(std::vector<std::string> const& args,
                         cmExecutionStatus& status)
 {
   if (args.empty()) {
-    status.SetError("QUERY subcommand called without required arguments.");
+    status.SetError("QUERY called without required arguments.");
     return false;
   }
 
@@ -97,21 +97,20 @@ bool handleQueryCommand(std::vector<std::string> const& args,
     return true;
   }
   if (!unparsedArguments.empty()) {
-    status.SetError("QUERY subcommand given unknown argument \"" +
+    status.SetError("QUERY given unknown argument \"" +
                     unparsedArguments.front() + "\".");
     return false;
   }
 
   if (!std::all_of(arguments.ApiVersion.begin(), arguments.ApiVersion.end(),
                    isCharDigit)) {
-    status.SetError("QUERY subcommand given a non-integer API_VERSION.");
+    status.SetError("QUERY given non-integer API_VERSION.");
     return false;
   }
   int const apiVersion = std::atoi(arguments.ApiVersion.c_str());
   if (apiVersion != 1) {
     status.SetError(
-      cmStrCat("QUERY subcommand given an unsupported API_VERSION \"",
-               arguments.ApiVersion,
+      cmStrCat("QUERY given unsupported API_VERSION \"", arguments.ApiVersion,
                "\" (the only currently supported version is 1)."));
     return false;
   }
@@ -138,7 +137,7 @@ bool handleQueryCommand(std::vector<std::string> const& args,
 
   if (!std::all_of(errors.begin(), errors.end(),
                    [](std::string const& s) -> bool { return s.empty(); })) {
-    std::string message("QUERY subcommand was given invalid arguments:");
+    std::string message("QUERY given invalid arguments:");
     for (std::string const& s : errors) {
       if (!s.empty()) {
         message = cmStrCat(message, "\n  ", s);

+ 6 - 6
Tests/RunCMake/FileAPI/ProjectQueryBad-stderr.txt

@@ -4,15 +4,15 @@ CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
 .*
 Invalid API version checks
 CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
-  cmake_file_api QUERY subcommand given an unsupported API_VERSION "2" \(the
-  only currently supported version is 1\)\.
+  cmake_file_api QUERY given unsupported API_VERSION "2" \(the only currently
+  supported version is 1\)\.
 .*
 CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
-  cmake_file_api QUERY subcommand given a non-integer API_VERSION\.
+  cmake_file_api QUERY given non-integer API_VERSION\.
 .*
 Invalid version numbers check
 CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
-  cmake_file_api QUERY subcommand was given invalid arguments:
+  cmake_file_api QUERY given invalid arguments:
 
     Given a malformed version "nope" for CODEMODEL\.
     Given a malformed version "-2" for CACHE\.
@@ -21,7 +21,7 @@ CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
 .*
 Requested versions too high check
 CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
-  cmake_file_api QUERY subcommand was given invalid arguments:
+  cmake_file_api QUERY given invalid arguments:
 
     None of the specified CODEMODEL versions is supported by this version of CMake\.
     None of the specified CACHE versions is supported by this version of CMake\.
@@ -30,7 +30,7 @@ CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
 .*
 Requested versions too low check
 CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\):
-  cmake_file_api QUERY subcommand was given invalid arguments:
+  cmake_file_api QUERY given invalid arguments:
 
     None of the specified CODEMODEL versions is supported by this version of CMake\.
     None of the specified CACHE versions is supported by this version of CMake\.