summaryrefslogtreecommitdiffstats
path: root/Source/cmDumpDocumentation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-02-19 22:36:19 (GMT)
committerBrad King <brad.king@kitware.com>2003-02-19 22:36:19 (GMT)
commite698c9c620991cb2421b60bed5ff39c7e1bbe7a7 (patch)
tree6d189ecc89e986b2838dd563dbdad91e6a936d08 /Source/cmDumpDocumentation.cxx
parentd78a4bab8c66e90c9c4afd8997ea713716dd088a (diff)
downloadCMake-e698c9c620991cb2421b60bed5ff39c7e1bbe7a7.zip
CMake-e698c9c620991cb2421b60bed5ff39c7e1bbe7a7.tar.gz
CMake-e698c9c620991cb2421b60bed5ff39c7e1bbe7a7.tar.bz2
ENH: Added option to dump all documentation (coverage).
Diffstat (limited to 'Source/cmDumpDocumentation.cxx')
-rw-r--r--Source/cmDumpDocumentation.cxx86
1 files changed, 78 insertions, 8 deletions
diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx
index a9e0a5d..9372ba1 100644
--- a/Source/cmDumpDocumentation.cxx
+++ b/Source/cmDumpDocumentation.cxx
@@ -21,15 +21,40 @@
#include "cmDocumentation.h"
-int main(int ac, char** av)
+//----------------------------------------------------------------------------
+static const cmDocumentationEntry cmDocumentationName[] =
+{
+ {0,
+ " DumpDocumentation - Dump documentation for CMake.", 0},
+ {0,0,0}
+};
+
+//----------------------------------------------------------------------------
+static const cmDocumentationEntry cmDocumentationUsage[] =
+{
+ {0,
+ " DumpDocumentation [filename]", 0},
+ {0,0,0}
+};
+
+//----------------------------------------------------------------------------
+static const cmDocumentationEntry cmDocumentationDescription[] =
+{
+ {0,
+ "CMake reads ... ", 0},
+ {0,0,0}
+};
+
+//----------------------------------------------------------------------------
+static const cmDocumentationEntry cmDocumentationOptions[] =
+{
+ {"--all-for-coverage", "Dump all documentation to stdout. For testing.", 0},
+ {0,0,0}
+};
+
+
+int DumpHTML(const char* outname)
{
- cmSystemTools::EnableMSVCDebugHook();
- cmake cmi;
- const char* outname = "cmake.html";
- if(ac > 1)
- {
- outname = av[1];
- }
std::ofstream fout(outname);
if(!fout)
{
@@ -37,6 +62,7 @@ int main(int ac, char** av)
return -1;
}
+ cmake cmi;
cmDocumentation doc;
std::vector<cmDocumentationEntry> commands;
cmi.GetCommandDocumentation(commands);
@@ -46,3 +72,47 @@ int main(int ac, char** av)
return 0;
}
+
+int DumpForCoverage()
+{
+ cmake cmi;
+ cmDocumentation doc;
+ std::vector<cmDocumentationEntry> commands;
+ cmi.GetCommandDocumentation(commands);
+ doc.SetNameSection(cmDocumentationName);
+ doc.SetUsageSection(cmDocumentationUsage);
+ doc.SetDescriptionSection(cmDocumentationDescription);
+ doc.SetOptionsSection(cmDocumentationOptions);
+ doc.SetCommandsSection(&commands[0]);
+ doc.PrintDocumentation(cmDocumentation::Usage, std::cout);
+ doc.PrintDocumentation(cmDocumentation::Full, std::cout);
+ doc.PrintDocumentation(cmDocumentation::HTML, std::cout);
+ doc.PrintDocumentation(cmDocumentation::Man, std::cout);
+}
+
+int main(int ac, char** av)
+{
+ cmSystemTools::EnableMSVCDebugHook();
+ const char* outname = "cmake.html";
+ bool coverage = false;
+ if(ac > 1)
+ {
+ if(strcmp(av[1], "--all-for-coverage") == 0)
+ {
+ coverage = true;
+ }
+ else
+ {
+ outname = av[1];
+ }
+ }
+
+ if(coverage)
+ {
+ return DumpForCoverage();
+ }
+ else
+ {
+ return DumpHTML(outname);
+ }
+}