add $si command

This commit is contained in:
Martin Michelsen
2023-12-23 10:23:40 -08:00
parent cf7c4674d6
commit 3823fc94f1
12 changed files with 89 additions and 8 deletions
+17 -1
View File
@@ -35,6 +35,7 @@
#include "Quest.hh"
#include "QuestScript.hh"
#include "ReplaySession.hh"
#include "Revision.hh"
#include "SaveFileFormats.hh"
#include "SendCommands.hh"
#include "Server.hh"
@@ -49,6 +50,7 @@ using namespace std;
bool use_terminal_colors = false;
void print_version_info();
void print_usage();
template <typename T>
@@ -204,6 +206,14 @@ Action a_help(
print_usage();
});
Action a_version(
"version", "\
version\n\
Show newserv\'s revision and build date.\n",
+[](Arguments&) -> void {
print_version_info();
});
static void a_compress_decompress_fn(Arguments& args) {
const auto& action = args.get<string>(0);
bool is_prs = ends_with(action, "-prs");
@@ -1890,8 +1900,14 @@ Action a_run_server_replay_log(
state->proxy_server.reset(); // Break reference cycle
});
void print_version_info() {
string build_date = format_time(BUILD_TIMESTAMP);
fprintf(stderr, "newserv-%s built %s UTC\n", GIT_REVISION_HASH, build_date.c_str());
}
void print_usage() {
fputs("\
print_version_info();
fputs("\n\
Usage:\n\
newserv [ACTION] [OPTIONS...]\n\
\n\