CLI: Add 'version' command
This commit is contained in:
parent
fa5e75893f
commit
94ade7238e
6
cli.cpp
6
cli.cpp
@ -8,6 +8,7 @@
|
|||||||
#include "authenticator.h"
|
#include "authenticator.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
CLIHandler::CLIHandler(Config &config, Database &db)
|
CLIHandler::CLIHandler(Config &config, Database &db)
|
||||||
{
|
{
|
||||||
@ -218,3 +219,8 @@ std::pair<std::string, std::vector<std::string>> CLIHandler::splitCommand(std::s
|
|||||||
splitted.erase(splitted.begin());
|
splitted.erase(splitted.begin());
|
||||||
return {cmd, splitted};
|
return {cmd, splitted};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::pair<bool, std::string> CLIHandler::version(const std::vector<std::string> &args)
|
||||||
|
{
|
||||||
|
return {true, get_version_string()};
|
||||||
|
}
|
||||||
|
4
cli.h
4
cli.h
@ -30,6 +30,7 @@ class CLIHandler
|
|||||||
std::pair<bool, std::string> user_set_perms(const std::vector<std::string> &args);
|
std::pair<bool, std::string> user_set_perms(const std::vector<std::string> &args);
|
||||||
std::pair<bool, std::string> user_list(const std::vector<std::string> &args);
|
std::pair<bool, std::string> user_list(const std::vector<std::string> &args);
|
||||||
std::pair<bool, std::string> user_show(const std::vector<std::string> &args);
|
std::pair<bool, std::string> user_show(const std::vector<std::string> &args);
|
||||||
|
std::pair<bool, std::string> version(const std::vector<std::string> &args);
|
||||||
|
|
||||||
std::vector<struct cmd> cmds{
|
std::vector<struct cmd> cmds{
|
||||||
{{"user",
|
{{"user",
|
||||||
@ -52,7 +53,8 @@ class CLIHandler
|
|||||||
return {true, ""};
|
return {true, ""};
|
||||||
}},
|
}},
|
||||||
{"help", "print this help", 0, {}, &CLIHandler::cli_help},
|
{"help", "print this help", 0, {}, &CLIHandler::cli_help},
|
||||||
{"attach", "attach to running instance", 0, {}, &CLIHandler::attach}}};
|
{"attach", "attach to running instance", 0, {}, &CLIHandler::attach},
|
||||||
|
{"version", "print verison info", 0, {}, &CLIHandler::version}}};
|
||||||
|
|
||||||
std::pair<bool, std::string> processCommand(const std::vector<CLIHandler::cmd> &commands, std::string cmd,
|
std::pair<bool, std::string> processCommand(const std::vector<CLIHandler::cmd> &commands, std::string cmd,
|
||||||
const std::vector<std::string> &args);
|
const std::vector<std::string> &args);
|
||||||
|
Loading…
Reference in New Issue
Block a user