Add version command

This commit is contained in:
Lncvrt committed 2026-03-11 21:54:36 -07:00
1 parent ab99a835f6
commit 4d7cfd0049
3 files changed
+13 -1

No files matched your search

+6 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 4.2.3)
project(TBCLI)
project(TBCLI VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 23)
@@ -15,4 +15,9 @@ file(GLOB_RECURSE SOURCES
)
add_executable(TBCLI ${SOURCES})
target_compile_definitions(TBCLI PRIVATE
PROJECT_VERSION="${PROJECT_VERSION}"
)
target_link_libraries(TBCLI OpenSSL::Crypto)
+2
View File
@@ -10,10 +10,12 @@ extern "C" {
void base64_decode_command(int argc, char *argv[]);
void base64_encode_command(int argc, char *argv[]);
void echo_command(int argc, char *argv[]);
void version_command(int argc, char *argv[]);
}
const std::vector<Command> commands = {
{"help", "Show this help message", help_command},
{"version", "A version command, to show the CLI version", version_command},
{"echo", "A echo command, usage \"echo (text)\"", echo_command},
{"base64-decode",
"A base64 decode command, \"base64-decode <text> [text2]\"",
+5
View File
@@ -0,0 +1,5 @@
#include <stdio.h>
void version_command(int argc, char *argv[]) {
printf("Version: %s\n", PROJECT_VERSION);
}