Skip to content
Snippets Groups Projects
Commit 8c2cf77e authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

lua: support both '-V' and '-v' options for version

Finally fix compatibility with Lua 5.1 command-line options.

Closes #1265
parent 9db64aed
No related branches found
No related tags found
No related merge requests found
......@@ -529,7 +529,7 @@ print_help(const char *program)
puts("All command line options are passed to the interpreted script.");
puts("When no script name is provided, the server responds to:");
puts(" -h, --help\t\t\tdisplay this help and exit");
puts(" -V, --version\t\t\tprint program version and exit");
puts(" -v, --version\t\t\tprint program version and exit");
puts(" -e EXPR\t\t\texecute string 'EXPR'");
puts(" -l NAME\t\t\trequire library 'NAME'");
puts(" -i\t\t\t\tenter interactive mode after executing 'SCRIPT'");
......@@ -560,15 +560,16 @@ main(int argc, char **argv)
static struct option longopts[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"version", no_argument, 0, 'v'},
{NULL, 0, 0, 0},
};
static const char *opts = "+hVie:l:";
static const char *opts = "+hVvie:l:";
int ch;
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
case 'V':
case 'v':
print_version();
return 0;
case 'h':
......
......@@ -6,7 +6,7 @@ Usage: tarantool script.lua [OPTIONS] [SCRIPT [ARGS]]
All command line options are passed to the interpreted script.
When no script name is provided, the server responds to:
-h, --help display this help and exit
-V, --version print program version and exit
-v, --version print program version and exit
-e EXPR execute string 'EXPR'
-l NAME require library 'NAME'
-i enter interactive mode after executing 'SCRIPT'
......@@ -24,7 +24,7 @@ Usage: tarantool script.lua [OPTIONS] [SCRIPT [ARGS]]
All command line options are passed to the interpreted script.
When no script name is provided, the server responds to:
-h, --help display this help and exit
-V, --version print program version and exit
-v, --version print program version and exit
-e EXPR execute string 'EXPR'
-l NAME require library 'NAME'
-i enter interactive mode after executing 'SCRIPT'
......@@ -51,6 +51,14 @@ Compiler: cc
C_FLAGS: flags
CXX_FLAGS: flags
tarantool -v
Tarantool 1.minor.patch-<rev>-<commit>
Target: platform <build>
Build options: flags
Compiler: cc
C_FLAGS: flags
CXX_FLAGS: flags
tarantool -V
Tarantool 1.minor.patch-<rev>-<commit>
Target: platform <build>
......
......@@ -21,6 +21,7 @@ sys.stdout.push_filter("CXX_FLAGS:.*", "CXX_FLAGS: flags")
sys.stdout.push_filter("Compiler: .*", "Compiler: cc")
server.test_option("--version")
server.test_option("-v")
server.test_option("-V ")
script = os.getenv("SOURCEDIR") + "/test/box-py/args.lua"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment