diff options
author | Ken Martin <ken.martin@kitware.com> | 2008-03-04 14:16:33 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2008-03-04 14:16:33 (GMT) |
commit | d47a5951edf48738db67dac22eef24de948965ec (patch) | |
tree | af6bc1dfefda26763e188227c276a811910ba9da /Source/cmDocumentation.cxx | |
parent | efb309fe2981f7030946b057544bc6c413c74744 (diff) | |
download | CMake-d47a5951edf48738db67dac22eef24de948965ec.zip CMake-d47a5951edf48738db67dac22eef24de948965ec.tar.gz CMake-d47a5951edf48738db67dac22eef24de948965ec.tar.bz2 |
ENH: add --help-policies and --help-policy command line options
Diffstat (limited to 'Source/cmDocumentation.cxx')
-rw-r--r-- | Source/cmDocumentation.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 58e7455..fca5b3e 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -338,6 +338,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) return this->PrintDocumentationSingle(os); case cmDocumentation::SingleModule: return this->PrintDocumentationSingleModule(os); + case cmDocumentation::SinglePolicy: + return this->PrintDocumentationSinglePolicy(os); case cmDocumentation::SingleProperty: return this->PrintDocumentationSingleProperty(os); case cmDocumentation::SingleVariable: @@ -381,6 +383,8 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) return this->PrintDocumentationModules(os); case cmDocumentation::CustomModules: return this->PrintDocumentationCustomModules(os); + case cmDocumentation::Policies: + return this->PrintDocumentationPolicies(os); case cmDocumentation::Properties: return this->PrintDocumentationProperties(os); case cmDocumentation::Variables: @@ -694,6 +698,12 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv) GET_OPT_ARGUMENT(help.Filename); help.HelpForm = this->GetFormFromFilename(help.Filename); } + else if(strcmp(argv[i], "--help-policies") == 0) + { + help.HelpType = cmDocumentation::Policies; + GET_OPT_ARGUMENT(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename); + } else if(strcmp(argv[i], "--help-variables") == 0) { help.HelpType = cmDocumentation::Variables; @@ -764,6 +774,13 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv) GET_OPT_ARGUMENT(help.Filename); help.HelpForm = this->GetFormFromFilename(help.Filename); } + else if(strcmp(argv[i], "--help-policy") == 0) + { + help.HelpType = cmDocumentation::SinglePolicy; + GET_OPT_ARGUMENT(help.Argument); + GET_OPT_ARGUMENT(help.Filename); + help.HelpForm = this->GetFormFromFilename(help.Filename); + } else if(strcmp(argv[i], "--help-variable") == 0) { help.HelpType = cmDocumentation::SingleVariable; @@ -1133,6 +1150,20 @@ bool cmDocumentation::PrintDocumentationSingleProperty(std::ostream& os) } //---------------------------------------------------------------------------- +bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os) +{ + if (this->PrintDocumentationGeneric(os,"Policies")) + { + return true; + } + + // Argument was not a command. Complain. + os << "Argument \"" << this->CurrentArgument.c_str() + << "\" to --help-policy is not a CMake policy.\n"; + return false; +} + +//---------------------------------------------------------------------------- bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os) { bool done = false; @@ -1233,6 +1264,21 @@ bool cmDocumentation::PrintDocumentationCustomModules(std::ostream& os) } //---------------------------------------------------------------------------- +bool cmDocumentation::PrintDocumentationPolicies(std::ostream& os) +{ + this->ClearSections(); + this->AddSectionToPrint("Description"); + this->AddSectionToPrint("Policies"); + this->AddSectionToPrint("Copyright"); + this->AddSectionToPrint("See Also"); + + this->CurrentFormatter->PrintHeader(this->GetNameString(), os); + this->Print(os); + this->CurrentFormatter->PrintFooter(os); + return true; +} + +//---------------------------------------------------------------------------- bool cmDocumentation::PrintDocumentationProperties(std::ostream& os) { this->ClearSections(); |