mirror of
https://github.com/Yet-Another-DreamTeam/quicknote.git
synced 2026-03-13 08:09:41 +00:00
add help output
This commit is contained in:
parent
52fe8fa52f
commit
e3325b1bd3
@ -41,6 +41,16 @@ public:
|
||||
this->commands.push_back(command);
|
||||
}
|
||||
|
||||
std::string getHelpAsString()
|
||||
{
|
||||
std::string help = "";
|
||||
for (auto &commandInfo : this->commands)
|
||||
{
|
||||
help += commandInfo.name + " - " + commandInfo.description + "\n";
|
||||
}
|
||||
return help;
|
||||
}
|
||||
|
||||
void execute(int argc, char *argv[])
|
||||
{
|
||||
|
||||
|
||||
@ -8,6 +8,9 @@ using namespace lpstd::exceptions;
|
||||
|
||||
namespace commands
|
||||
{
|
||||
|
||||
Command &command = Command::Instance();
|
||||
|
||||
void add(int argc, char *argv[])
|
||||
{
|
||||
std::cout << "add" << std::endl;
|
||||
@ -53,8 +56,8 @@ namespace commands
|
||||
|
||||
void help(int argc, char *argv[])
|
||||
{
|
||||
std::cout << "help" << std::endl;
|
||||
throw NotImplementedException();
|
||||
// std::cout << "help" << std::endl;
|
||||
std::cout << command.getHelpAsString() << std::endl;
|
||||
}
|
||||
|
||||
} // namespace commands
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
#include "./command.h"
|
||||
#include "./commands.h"
|
||||
|
||||
Setup setup;
|
||||
Command command;
|
||||
Setup &setup = Setup::Instance();
|
||||
Command &command = Command::Instance();
|
||||
Loading…
x
Reference in New Issue
Block a user