Ordermman

This commit is contained in:
Pedro Pinto committed 2017-09-30 14:58:51 +00:00
1 parent 5f937ac94a
commit 29460fabf6
27 files changed
+491 -63

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
#include "Help.h"
#include "server/sparkd/cmds/CmdRegistry.h"
#include <iostream>
namespace bts {
namespace cmd {
int Help::execute(std::vector<std::string> const &args)
{
auto commands = CmdRegistry::cmds ();
if (args.size () != 1 || CmdRegistry::retrieve (args[0]) == 0) {
std::cerr << "Syntax: sparkd <cmd> <args> or sparkd help <cmd>, where cmd is one of: "
<< std::endl;
for (auto &cmd : commands)
std::cerr << "\t" << cmd << std::endl;
return 0;
} else {
auto cmd = CmdRegistry::retrieve (args[0]);
std::cerr << "sparkd " << args[0] << ":" << std::endl << cmd->help () << std::endl;
return 0;
}
}
std::string Help::help ()
{
return "Display help.";
}
}}