Add command line option "repmgr --version-number"

Outputs the raw version number.

Intended for use by scripts etc.
This commit is contained in:
Ian Barwick
2019-01-08 10:04:25 +09:00
parent b89b3c0961
commit b5b9aacc8a
4 changed files with 37 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
4.3 2019-??
repmgr: add --version-number command line option (Ian)
repmgrd: check binary and extension major versions match; GitHub #515 (Ian)
4.2.1 2018-??-??

View File

@@ -15,6 +15,31 @@
See also: <xref linkend="upgrading-repmgr">
</para>
<sect1 id="release-4.3">
<title>Release 4.3</title>
<para><emphasis>???, 2019</emphasis></para>
<para>
&repmgr; 4.3 is a major release.
</para>
<sect2>
<title>repmgr enhancements</title>
<para>
<itemizedlist>
<listitem>
<para>
<command>repmgr --version-number</command> outputs the &quot;raw&quot;
repmgr version number (e.g. <literal>40300</literal>). This is intended
for use by scripts etc. requiring an easily parseable representation
of the &repmgr; version.
</para>
</listitem>
</itemizedlist>
</para>
</sect2>
</sect1>
<sect1 id="release-4.2">
<title>Release 4.2</title>
<para><emphasis>Wed October 24, 2018</emphasis></para>

View File

@@ -205,6 +205,7 @@ main(int argc, char **argv)
help_option = true;
break;
/* -V/--version */
case 'V':
/*
@@ -215,6 +216,11 @@ main(int argc, char **argv)
printf("%s %s\n", progname(), REPMGR_VERSION);
exit(SUCCESS);
/* --version-number */
case OPT_VERSION_NUMBER:
printf("%i\n", REPMGR_VERSION_NUM);
exit(SUCCESS);
/*------------------------------
* general configuration options
*------------------------------
@@ -2012,6 +2018,7 @@ do_help(void)
printf(_("General options:\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" --version-number output version number, then exit\n"));
puts("");
printf(_("General configuration options:\n"));

View File

@@ -92,6 +92,8 @@
#define OPT_NO_WAIT 1040
#define OPT_MISSING_SLOTS 1041
#define OPT_REPMGRD_NO_PAUSE 1042
#define OPT_VERSION_NUMBER 1043
/* deprecated since 3.3 */
#define OPT_DATA_DIR 999
@@ -102,8 +104,9 @@
static struct option long_options[] =
{
/* general options */
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, OPT_HELP},
{"version", no_argument, NULL, 'V'},
{"version-number", no_argument, NULL, OPT_VERSION_NUMBER},
/* general configuration options */
{"config-file", required_argument, NULL, 'f'},