From 48381a5b4e3493314b0a28b5a9b11e9d9fddee62 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Sat, 2 Feb 2019 13:05:39 +0900 Subject: [PATCH] Use --compact option for abbreviated display output --terse is meant for reducing log chatter. --- HISTORY | 2 +- doc/appendix-release-notes.sgml | 2 +- doc/repmgr-cluster-show.sgml | 11 ++++++++++- repmgr-action-cluster.c | 5 +++-- repmgr-client-global.h | 3 ++- repmgr-client.c | 6 ++++++ repmgr-client.h | 2 ++ 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index 429efc17..9d6efa31 100644 --- a/HISTORY +++ b/HISTORY @@ -1,7 +1,7 @@ 4.3 2019-?? repmgr: add "daemon (start|stop)" command; GitHub #528 (Ian) repmgr: add --version-number command line option (Ian) - repmgr: add --terse option to "cluster show"; GitHub #521 (Ian) + repmgr: add --compact option to "cluster show"; GitHub #521 (Ian) repmgr: add --dry-run option to "standby promote"; GitHub #522 (Ian) repmgr: add "node check --data-directory-config"; GitHub #523 (Ian) repmgr: prevent potential race condition in "standby switchover" diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml index 40047571..6c2573c5 100644 --- a/doc/appendix-release-notes.sgml +++ b/doc/appendix-release-notes.sgml @@ -81,7 +81,7 @@ REPMGRD_OPTS="--daemonize=false" - Add option to repmgr cluster show (GitHub #521). + Add option to repmgr cluster show (GitHub #521). This makes it easier to copy the output into emails, chats etc. as a compact table. diff --git a/doc/repmgr-cluster-show.sgml b/doc/repmgr-cluster-show.sgml index b702bf80..71214e23 100644 --- a/doc/repmgr-cluster-show.sgml +++ b/doc/repmgr-cluster-show.sgml @@ -120,11 +120,20 @@ + + + + + Suppress display of the conninfo column. + + + + - Suppress display of the conninfo column. + Suppress warnings about connection issues. diff --git a/repmgr-action-cluster.c b/repmgr-action-cluster.c index 3b078d35..b2011306 100644 --- a/repmgr-action-cluster.c +++ b/repmgr-action-cluster.c @@ -120,7 +120,7 @@ do_cluster_show(void) { headers_show[i].display = true; - if (runtime_options.terse == true) + if (runtime_options.compact == true) { if (i == SHOW_CONNINFO) { @@ -361,7 +361,7 @@ do_cluster_show(void) for (i = 0; i < SHOW_HEADER_COUNT; i++) { - if (runtime_options.terse == true) + if (runtime_options.compact == true) { if (headers_show[i].display == false) continue; @@ -1518,6 +1518,7 @@ do_cluster_help(void) printf(_(" Configuration file or database connection required.\n")); puts(""); printf(_(" --csv emit output as CSV (with a subset of fields)\n")); + printf(_(" --compact display only a subset of fields\n")); puts(""); printf(_("CLUSTER MATRIX\n")); diff --git a/repmgr-client-global.h b/repmgr-client-global.h index b8d6de7c..ded775b0 100644 --- a/repmgr-client-global.h +++ b/repmgr-client-global.h @@ -44,6 +44,7 @@ typedef struct char pg_bindir[MAXLEN]; /* overrides setting in repmgr.conf */ int wait; bool no_wait; + bool compact; /* logging options */ char log_level[MAXLEN]; /* overrides setting in repmgr.conf */ @@ -140,7 +141,7 @@ typedef struct /* configuration metadata */ \ false, false, false, false, false, \ /* general configuration options */ \ - "", false, false, "", -1, false, \ + "", false, false, "", -1, false, false, \ /* logging options */ \ "", false, false, false, false, \ /* output options */ \ diff --git a/repmgr-client.c b/repmgr-client.c index dde5f332..0840163d 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -267,6 +267,12 @@ main(int argc, char **argv) runtime_options.no_wait = true; break; + /* --compact */ + case OPT_COMPACT: + runtime_options.compact = true; + break; + + /*---------------------------- * database connection options *---------------------------- diff --git a/repmgr-client.h b/repmgr-client.h index 064d9d35..8a8bbf15 100644 --- a/repmgr-client.h +++ b/repmgr-client.h @@ -96,6 +96,7 @@ #define OPT_REPMGRD_NO_PAUSE 1042 #define OPT_VERSION_NUMBER 1043 #define OPT_DATA_DIRECTORY_CONFIG 1044 +#define OPT_COMPACT 1045 /* deprecated since 3.3 */ @@ -118,6 +119,7 @@ static struct option long_options[] = {"pg_bindir", required_argument, NULL, 'b'}, {"wait", optional_argument, NULL, 'w'}, {"no-wait", no_argument, NULL, 'W'}, + {"compact", no_argument, NULL, OPT_COMPACT}, /* connection options */ {"dbname", required_argument, NULL, 'd'},