From 94ade7238e38695b9347f7d12a65d5623ac03ca5 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 3 Oct 2021 23:04:46 +0200 Subject: [PATCH] CLI: Add 'version' command --- cli.cpp | 6 ++++++ cli.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cli.cpp b/cli.cpp index cc8ce68..e816021 100644 --- a/cli.cpp +++ b/cli.cpp @@ -8,6 +8,7 @@ #include "authenticator.h" #include "config.h" #include "logger.h" +#include "version.h" CLIHandler::CLIHandler(Config &config, Database &db) { @@ -218,3 +219,8 @@ std::pair> CLIHandler::splitCommand(std::s splitted.erase(splitted.begin()); return {cmd, splitted}; } + +std::pair CLIHandler::version(const std::vector &args) +{ + return {true, get_version_string()}; +} diff --git a/cli.h b/cli.h index ab26530..5b5835f 100644 --- a/cli.h +++ b/cli.h @@ -30,6 +30,7 @@ class CLIHandler std::pair user_set_perms(const std::vector &args); std::pair user_list(const std::vector &args); std::pair user_show(const std::vector &args); + std::pair version(const std::vector &args); std::vector cmds{ {{"user", @@ -52,7 +53,8 @@ class CLIHandler return {true, ""}; }}, {"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 processCommand(const std::vector &commands, std::string cmd, const std::vector &args);