From: Kahrl Date: Wed, 25 Sep 2013 02:47:44 +0000 (+0200) Subject: Add --version option X-Git-Tag: 0.4.8~117 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5dce44ec5e5f7231dba3cdbec3f1fdc683ce5a34;p=oweals%2Fminetest.git Add --version option --- diff --git a/doc/minetest.6 b/doc/minetest.6 index 80991289e..d94c12cb6 100644 --- a/doc/minetest.6 +++ b/doc/minetest.6 @@ -37,6 +37,9 @@ Disable main menu \-\-help Show allowed options .TP +\-\-version +Show version information +.TP \-\-logfile Set logfile path (debug.txt) .TP diff --git a/doc/minetestserver.6 b/doc/minetestserver.6 index 35c4a1fe6..1d4a5f838 100644 --- a/doc/minetestserver.6 +++ b/doc/minetestserver.6 @@ -31,6 +31,9 @@ Set gameid \-\-help Show allowed options .TP +\-\-version +Show version information +.TP \-\-logfile Set logfile path (debug.txt) .TP diff --git a/src/main.cpp b/src/main.cpp index 10547b711..455138d5b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -772,6 +772,8 @@ int main(int argc, char *argv[]) std::map allowed_options; allowed_options.insert(std::make_pair("help", ValueSpec(VALUETYPE_FLAG, _("Show allowed options")))); + allowed_options.insert(std::make_pair("version", ValueSpec(VALUETYPE_FLAG, + _("Show version information")))); allowed_options.insert(std::make_pair("config", ValueSpec(VALUETYPE_STRING, _("Load configuration from specified file")))); allowed_options.insert(std::make_pair("port", ValueSpec(VALUETYPE_STRING, @@ -843,6 +845,18 @@ int main(int argc, char *argv[]) return cmd_args.getFlag("help") ? 0 : 1; } + + if(cmd_args.getFlag("version")) + { +#ifdef SERVER + dstream<<"minetestserver "<