From b5b9aacc8ab60e1941e3c66b79684a5754de37f7 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 8 Jan 2019 10:04:25 +0900 Subject: [PATCH] Add command line option "repmgr --version-number" Outputs the raw version number. Intended for use by scripts etc. --- HISTORY | 1 + doc/appendix-release-notes.sgml | 25 +++++++++++++++++++++++++ repmgr-client.c | 7 +++++++ repmgr-client.h | 5 ++++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 6cee602b..395b60fb 100644 --- a/HISTORY +++ b/HISTORY @@ -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-??-?? diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml index dea097c3..10e90e2b 100644 --- a/doc/appendix-release-notes.sgml +++ b/doc/appendix-release-notes.sgml @@ -15,6 +15,31 @@ See also: + + Release 4.3 + ???, 2019 + + &repmgr; 4.3 is a major release. + + + repmgr enhancements + + + + + + repmgr --version-number outputs the "raw" + repmgr version number (e.g. 40300). This is intended + for use by scripts etc. requiring an easily parseable representation + of the &repmgr; version. + + + + + + + + Release 4.2 Wed October 24, 2018 diff --git a/repmgr-client.c b/repmgr-client.c index 331d65dc..92be35f6 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -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")); diff --git a/repmgr-client.h b/repmgr-client.h index c80fb673..d4e20a89 100644 --- a/repmgr-client.h +++ b/repmgr-client.h @@ -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'},