diff --git a/client/tarantool/tc.c b/client/tarantool/tc.c index 68c0f6f92180c298249145c1e38b84f6c22358dd..862d18443c7bbfc82934b1ae0ae7caa01b46dff7 100644 --- a/client/tarantool/tc.c +++ b/client/tarantool/tc.c @@ -101,6 +101,9 @@ int main(int argc, char *argv[]) case TC_OPT_USAGE: tc_opt_usage(); break; + case TC_OPT_VERSION: + tc_opt_version(); + break; case TC_OPT_RPL: tc_connect(); rc = tc_wal_remote(); diff --git a/client/tarantool/tc_opt.c b/client/tarantool/tc_opt.c index 08bbd4bf14f9a88711bf2f7da6f85a2ba0cfaee4..b0210845e19cbb9377a39b374a808ae924b046cb 100644 --- a/client/tarantool/tc_opt.c +++ b/client/tarantool/tc_opt.c @@ -52,7 +52,9 @@ static const void *tc_options_def = gopt_start( gopt_option('R', GOPT_ARG, gopt_shorts('R'), gopt_longs("rpl"), " <lsn>", "act as replica for the specified server"), gopt_option('h', 0, gopt_shorts('h', '?'), gopt_longs("help"), - NULL, "display this help and exit") + NULL, "display this help and exit"), + gopt_option('v', 0, gopt_shorts('v'), gopt_longs("version"), + NULL, "display version information and exit") ); void tc_opt_usage(void) @@ -63,6 +65,14 @@ void tc_opt_usage(void) exit(0); } +void tc_opt_version(void) +{ + printf("tarantool client, version %s.%s\n", + TC_VERSION_MAJOR, + TC_VERSION_MINOR); + exit(0); +} + enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv) { /* usage */ @@ -72,6 +82,12 @@ enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv) goto done; } + /* version */ + if (gopt(tc_options, 'v')) { + opt->mode = TC_OPT_VERSION; + goto done; + } + /* server host */ gopt_arg(tc_options, 'a', &opt->host); if (opt->host == NULL) diff --git a/client/tarantool/tc_opt.h b/client/tarantool/tc_opt.h index 2e7ff605c7611041560076d226625ea179ca72de..ef2118d928c3e32842e93c25bb8b839389cfe72f 100644 --- a/client/tarantool/tc_opt.h +++ b/client/tarantool/tc_opt.h @@ -26,8 +26,12 @@ * SUCH DAMAGE. */ +#define TC_VERSION_MAJOR "0" +#define TC_VERSION_MINOR "1" + enum tc_opt_mode { TC_OPT_USAGE, + TC_OPT_VERSION, TC_OPT_RPL, TC_OPT_WAL_CAT, TC_OPT_WAL_PLAY, @@ -47,6 +51,7 @@ struct tc_opt { }; void tc_opt_usage(void); +void tc_opt_version(void); enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv); diff --git a/doc/man/tarantool.pod b/doc/man/tarantool.pod index 06c1e1ae54a5a50c6f5d3be5ea43ebc59de0a488..b82b850fbf838b3093ab1fef645a9b036e851ae1 100644 --- a/doc/man/tarantool.pod +++ b/doc/man/tarantool.pod @@ -12,20 +12,35 @@ tarantool - readline SQL-client for L<tarantool>. =item -a <host>, --host <host> -Defines Server address. +Defines server address. =item -p <port>, --port <port> Defines server port. -=item -m <port>, --port-admin <port> +=item -m <port>, --admin-port <port> -Defines Server admin port. +Defines server admin port. + +=item -C <file>, --cat <file> + +Outputs xlog file content. + +=item -P <file>, --play <file> + +Replays xlog file to the specified server. + +=item -R <lsn>, --rpl <lsn> + +Acts as replica for the specified server. =item -h, --help Displays helpscreen and exits. -=back +=item -v, --version +Displays version and exits. + +=back