Skip to content
Snippets Groups Projects
Commit 2590b285 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'client-version'

parents 9e6a0ac5 4f73691a
No related merge requests found
...@@ -101,6 +101,9 @@ int main(int argc, char *argv[]) ...@@ -101,6 +101,9 @@ int main(int argc, char *argv[])
case TC_OPT_USAGE: case TC_OPT_USAGE:
tc_opt_usage(); tc_opt_usage();
break; break;
case TC_OPT_VERSION:
tc_opt_version();
break;
case TC_OPT_RPL: case TC_OPT_RPL:
tc_connect(); tc_connect();
rc = tc_wal_remote(); rc = tc_wal_remote();
......
...@@ -52,7 +52,9 @@ static const void *tc_options_def = gopt_start( ...@@ -52,7 +52,9 @@ static const void *tc_options_def = gopt_start(
gopt_option('R', GOPT_ARG, gopt_shorts('R'), gopt_option('R', GOPT_ARG, gopt_shorts('R'),
gopt_longs("rpl"), " <lsn>", "act as replica for the specified server"), gopt_longs("rpl"), " <lsn>", "act as replica for the specified server"),
gopt_option('h', 0, gopt_shorts('h', '?'), gopt_longs("help"), 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) void tc_opt_usage(void)
...@@ -63,6 +65,14 @@ void tc_opt_usage(void) ...@@ -63,6 +65,14 @@ void tc_opt_usage(void)
exit(0); 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) enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv)
{ {
/* usage */ /* usage */
...@@ -72,6 +82,12 @@ enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv) ...@@ -72,6 +82,12 @@ enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv)
goto done; goto done;
} }
/* version */
if (gopt(tc_options, 'v')) {
opt->mode = TC_OPT_VERSION;
goto done;
}
/* server host */ /* server host */
gopt_arg(tc_options, 'a', &opt->host); gopt_arg(tc_options, 'a', &opt->host);
if (opt->host == NULL) if (opt->host == NULL)
......
...@@ -26,8 +26,12 @@ ...@@ -26,8 +26,12 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#define TC_VERSION_MAJOR "0"
#define TC_VERSION_MINOR "1"
enum tc_opt_mode { enum tc_opt_mode {
TC_OPT_USAGE, TC_OPT_USAGE,
TC_OPT_VERSION,
TC_OPT_RPL, TC_OPT_RPL,
TC_OPT_WAL_CAT, TC_OPT_WAL_CAT,
TC_OPT_WAL_PLAY, TC_OPT_WAL_PLAY,
...@@ -47,6 +51,7 @@ struct tc_opt { ...@@ -47,6 +51,7 @@ struct tc_opt {
}; };
void tc_opt_usage(void); void tc_opt_usage(void);
void tc_opt_version(void);
enum tc_opt_mode enum tc_opt_mode
tc_opt_init(struct tc_opt *opt, int argc, char **argv); tc_opt_init(struct tc_opt *opt, int argc, char **argv);
......
...@@ -12,20 +12,35 @@ tarantool - readline SQL-client for L<tarantool>. ...@@ -12,20 +12,35 @@ tarantool - readline SQL-client for L<tarantool>.
=item -a <host>, --host <host> =item -a <host>, --host <host>
Defines Server address. Defines server address.
=item -p <port>, --port <port> =item -p <port>, --port <port>
Defines server 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 =item -h, --help
Displays helpscreen and exits. Displays helpscreen and exits.
=back =item -v, --version
Displays version and exits.
=back
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