blob: 395baed13429f46a118706011a0d06dd244ee9f6 (
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
33
|
#include "showHelp.h"
#include <options.h>
#include <boost/bind.hpp>
#include <options/flagSet.h>
void ShowHelpComponent::onConfigLoad()
{
if (!showHelp)
return;
fprintf(stdout, "Help\n");
for (auto opts : AdHoc::PluginManager::getDefault()->getAll<Options>()) {
outputOptions(opts->implementation());
}
exit(1);
}
void ShowHelpComponent::outputOptions(const Options * options) const
{
fprintf(stdout, " * %s\n", options->name.c_str());
for (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;
NAMEDPLUGIN("ShowHelpComponent", ShowHelpComponent, LifeCycle);
|