blob: acdede66af76968daa6d3da81b41a0f51bcb1640 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "showHelp.h"
#include <options.h>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <options/flagSet.h>
void ShowHelpComponent::onConfigLoad()
{
if (!showHelp)
return;
fprintf(stdout, "Help\n");
InstanceSet<Options>::OnAll(boost::bind(&ShowHelpComponent::outputOptions, this, _1));
exit(1);
}
void ShowHelpComponent::outputOptions(const Options * options) const
{
fprintf(stdout, " * %s\n", options->name.c_str());
BOOST_FOREACH(const auto & option, options->allOptions()) {
fprintf(stdout, " * %s - %s\n", option->name().c_str(), option->description().c_str());
}
}
Options::TargetPtr
ShowHelpComponent::Option()
{
return new OptionFlagSet(&showHelp);
}
bool ShowHelpComponent::showHelp;
DECLARE_COMPONENT("ShowHelpComponent", ShowHelpComponent);
|