Ordermman
This commit is contained in:
1 parent
5f937ac94a
commit
29460fabf6
27 files changed
+491
-63
No files matched your search
Executable
+31
@@ -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.";
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user