Use --compact option for abbreviated display output

--terse is meant for reducing log chatter.
This commit is contained in:
Ian Barwick
2019-02-02 13:05:39 +09:00
parent 20b79f998c
commit 48381a5b4e
7 changed files with 25 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
4.3 2019-?? 4.3 2019-??
repmgr: add "daemon (start|stop)" command; GitHub #528 (Ian) repmgr: add "daemon (start|stop)" command; GitHub #528 (Ian)
repmgr: add --version-number command line option (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 --dry-run option to "standby promote"; GitHub #522 (Ian)
repmgr: add "node check --data-directory-config"; GitHub #523 (Ian) repmgr: add "node check --data-directory-config"; GitHub #523 (Ian)
repmgr: prevent potential race condition in "standby switchover" repmgr: prevent potential race condition in "standby switchover"

View File

@@ -81,7 +81,7 @@ REPMGRD_OPTS="--daemonize=false"</programlisting>
<listitem> <listitem>
<para> <para>
Add <option>--terse</option> option to <command><link linkend="repmgr-cluster-show">repmgr cluster show</link></command> (GitHub #521). Add <option>--compact</option> option to <command><link linkend="repmgr-cluster-show">repmgr cluster show</link></command> (GitHub #521).
</para> </para>
<para> <para>
This makes it easier to copy the output into emails, chats etc. as a compact table. This makes it easier to copy the output into emails, chats etc. as a compact table.

View File

@@ -120,11 +120,20 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>--compact</option></term>
<listitem>
<para>
Suppress display of the <literal>conninfo</literal> column.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>--terse</option></term> <term><option>--terse</option></term>
<listitem> <listitem>
<para> <para>
Suppress display of the <literal>conninfo</literal> column. Suppress warnings about connection issues.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -120,7 +120,7 @@ do_cluster_show(void)
{ {
headers_show[i].display = true; headers_show[i].display = true;
if (runtime_options.terse == true) if (runtime_options.compact == true)
{ {
if (i == SHOW_CONNINFO) if (i == SHOW_CONNINFO)
{ {
@@ -361,7 +361,7 @@ do_cluster_show(void)
for (i = 0; i < SHOW_HEADER_COUNT; i++) for (i = 0; i < SHOW_HEADER_COUNT; i++)
{ {
if (runtime_options.terse == true) if (runtime_options.compact == true)
{ {
if (headers_show[i].display == false) if (headers_show[i].display == false)
continue; continue;
@@ -1518,6 +1518,7 @@ do_cluster_help(void)
printf(_(" Configuration file or database connection required.\n")); printf(_(" Configuration file or database connection required.\n"));
puts(""); puts("");
printf(_(" --csv emit output as CSV (with a subset of fields)\n")); printf(_(" --csv emit output as CSV (with a subset of fields)\n"));
printf(_(" --compact display only a subset of fields\n"));
puts(""); puts("");
printf(_("CLUSTER MATRIX\n")); printf(_("CLUSTER MATRIX\n"));

View File

@@ -44,6 +44,7 @@ typedef struct
char pg_bindir[MAXLEN]; /* overrides setting in repmgr.conf */ char pg_bindir[MAXLEN]; /* overrides setting in repmgr.conf */
int wait; int wait;
bool no_wait; bool no_wait;
bool compact;
/* logging options */ /* logging options */
char log_level[MAXLEN]; /* overrides setting in repmgr.conf */ char log_level[MAXLEN]; /* overrides setting in repmgr.conf */
@@ -140,7 +141,7 @@ typedef struct
/* configuration metadata */ \ /* configuration metadata */ \
false, false, false, false, false, \ false, false, false, false, false, \
/* general configuration options */ \ /* general configuration options */ \
"", false, false, "", -1, false, \ "", false, false, "", -1, false, false, \
/* logging options */ \ /* logging options */ \
"", false, false, false, false, \ "", false, false, false, false, \
/* output options */ \ /* output options */ \

View File

@@ -267,6 +267,12 @@ main(int argc, char **argv)
runtime_options.no_wait = true; runtime_options.no_wait = true;
break; break;
/* --compact */
case OPT_COMPACT:
runtime_options.compact = true;
break;
/*---------------------------- /*----------------------------
* database connection options * database connection options
*---------------------------- *----------------------------

View File

@@ -96,6 +96,7 @@
#define OPT_REPMGRD_NO_PAUSE 1042 #define OPT_REPMGRD_NO_PAUSE 1042
#define OPT_VERSION_NUMBER 1043 #define OPT_VERSION_NUMBER 1043
#define OPT_DATA_DIRECTORY_CONFIG 1044 #define OPT_DATA_DIRECTORY_CONFIG 1044
#define OPT_COMPACT 1045
/* deprecated since 3.3 */ /* deprecated since 3.3 */
@@ -118,6 +119,7 @@ static struct option long_options[] =
{"pg_bindir", required_argument, NULL, 'b'}, {"pg_bindir", required_argument, NULL, 'b'},
{"wait", optional_argument, NULL, 'w'}, {"wait", optional_argument, NULL, 'w'},
{"no-wait", no_argument, NULL, 'W'}, {"no-wait", no_argument, NULL, 'W'},
{"compact", no_argument, NULL, OPT_COMPACT},
/* connection options */ /* connection options */
{"dbname", required_argument, NULL, 'd'}, {"dbname", required_argument, NULL, 'd'},