diff options
Diffstat (limited to 'Source/cmDocumentation.cxx')
-rw-r--r-- | Source/cmDocumentation.cxx | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 9df1e79..3ff1017 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -113,7 +113,9 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) switch (ht) { case cmDocumentation::Usage: - return this->PrintDocumentationUsage(os); + return this->PrintUsage(os); + case cmDocumentation::Help: + return this->PrintHelp(os); case cmDocumentation::Full: return this->PrintHelpFull(os); case cmDocumentation::OneManual: @@ -300,7 +302,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, (strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "-H") == 0)) { - help.HelpType = cmDocumentation::Usage; + help.HelpType = cmDocumentation::Help; GET_OPT_ARGUMENT(help.Argument); help.Argument = cmSystemTools::LowerCase(help.Argument); // special case for single command @@ -481,9 +483,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } //---------------------------------------------------------------------------- -void cmDocumentation::SetName(const char* name) +void cmDocumentation::SetName(const std::string& name) { - this->NameString = name?name:""; + this->NameString = name; } //---------------------------------------------------------------------------- @@ -676,7 +678,7 @@ bool cmDocumentation::PrintFiles(std::ostream& os, for (std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) { - found = r.ProcessFile(i->c_str()) || found; + found = r.ProcessFile(*i) || found; } return found; } @@ -703,7 +705,7 @@ bool cmDocumentation::PrintHelpOneManual(std::ostream& os) return true; } // Argument was not a manual. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-manual is not an available manual. " << "Use --help-manual-list to see all available manuals.\n"; return false; @@ -725,7 +727,7 @@ bool cmDocumentation::PrintHelpOneCommand(std::ostream& os) return true; } // Argument was not a command. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-command is not a CMake command. " << "Use --help-command-list to see all commands.\n"; return false; @@ -747,7 +749,7 @@ bool cmDocumentation::PrintHelpOneModule(std::ostream& os) return true; } // Argument was not a module. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-module is not a CMake module.\n"; return false; } @@ -782,7 +784,7 @@ bool cmDocumentation::PrintHelpOneProperty(std::ostream& os) return true; } // Argument was not a property. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-property is not a CMake property. " << "Use --help-property-list to see all properties.\n"; return false; @@ -806,7 +808,7 @@ bool cmDocumentation::PrintHelpOnePolicy(std::ostream& os) } // Argument was not a policy. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-policy is not a CMake policy.\n"; return false; } @@ -827,7 +829,7 @@ bool cmDocumentation::PrintHelpOneVariable(std::ostream& os) return true; } // Argument was not a variable. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-variable is not a defined variable. " << "Use --help-variable-list to see all defined variables.\n"; return false; @@ -841,7 +843,19 @@ bool cmDocumentation::PrintHelpListVariables(std::ostream& os) } //---------------------------------------------------------------------------- -bool cmDocumentation::PrintDocumentationUsage(std::ostream& os) +bool cmDocumentation::PrintUsage(std::ostream& os) +{ + std::map<std::string,cmDocumentationSection*>::iterator si; + si = this->AllSections.find("Usage"); + if(si != this->AllSections.end()) + { + this->Formatter.PrintSection(os, *si->second); + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmDocumentation::PrintHelp(std::ostream& os) { std::map<std::string,cmDocumentationSection*>::iterator si; si = this->AllSections.find("Usage"); |