Add version command
This commit is contained in:
3 files changed
+13
-1
No files matched your search
+6
-1
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 4.2.3)
|
cmake_minimum_required(VERSION 4.2.3)
|
||||||
|
|
||||||
project(TBCLI)
|
project(TBCLI VERSION 1.0.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
@@ -15,4 +15,9 @@ file(GLOB_RECURSE SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_executable(TBCLI ${SOURCES})
|
add_executable(TBCLI ${SOURCES})
|
||||||
|
|
||||||
|
target_compile_definitions(TBCLI PRIVATE
|
||||||
|
PROJECT_VERSION="${PROJECT_VERSION}"
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(TBCLI OpenSSL::Crypto)
|
target_link_libraries(TBCLI OpenSSL::Crypto)
|
||||||
@@ -10,10 +10,12 @@ extern "C" {
|
|||||||
void base64_decode_command(int argc, char *argv[]);
|
void base64_decode_command(int argc, char *argv[]);
|
||||||
void base64_encode_command(int argc, char *argv[]);
|
void base64_encode_command(int argc, char *argv[]);
|
||||||
void echo_command(int argc, char *argv[]);
|
void echo_command(int argc, char *argv[]);
|
||||||
|
void version_command(int argc, char *argv[]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Command> commands = {
|
const std::vector<Command> commands = {
|
||||||
{"help", "Show this help message", help_command},
|
{"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},
|
{"echo", "A echo command, usage \"echo (text)\"", echo_command},
|
||||||
{"base64-decode",
|
{"base64-decode",
|
||||||
"A base64 decode command, \"base64-decode <text> [text2]\"",
|
"A base64 decode command, \"base64-decode <text> [text2]\"",
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void version_command(int argc, char *argv[]) {
|
||||||
|
printf("Version: %s\n", PROJECT_VERSION);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user