Skip to content

Commit fe96d69

Browse files
committed
Low: Tools: Massage help text contents and output
Mercurial revision: 3aa095660d4c7d3d0f0b99c4d541de9606c0559c
1 parent b437ebb commit fe96d69

File tree

12 files changed

+175
-155
lines changed

12 files changed

+175
-155
lines changed

tools/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ sbin_PROGRAMS = crmadmin cibadmin crm_node crm_attribute crm_resource crm_verif
4444
if BUILD_HELP
4545
man8_MANS = $(sbin_PROGRAMS:%=%.8)
4646
%.8: %
47+
$(abs_builddir)/$< --help
4748
help2man --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(abs_builddir)/$<
4849
endif
4950

tools/attrd_updater.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ char command = 'q';
3939

4040
static struct crm_option long_options[] = {
4141
/* Top-level Options */
42-
{"help", 0, 0, '?', "This text"},
43-
{"version", 0, 0, '$', "Version information" },
44-
{"verbose", 0, 0, 'V', "Increase debug output\n"},
42+
{"help", 0, 0, '?', "\tThis text"},
43+
{"version", 0, 0, '$', "\tVersion information" },
44+
{"verbose", 0, 0, 'V', "\tIncrease debug output\n"},
4545

4646
{"name", 1, 0, 'n', "The attribute's name"},
4747

48-
{"-spacer-",1, 0, '-', "\nCommands:\n"},
48+
{"-spacer-",1, 0, '-', "\nCommands:"},
4949
{"update", 1, 0, 'U', "Update the attribute's value in attrd. If this causes the value to change, it will also be updated in the cluster configuration"},
5050
{"query", 0, 0, 'Q', "\tQuery the attribute's value from attrd"},
5151
{"delete", 0, 0, 'D', "\tDelete the attribute in attrd. If a value was previously set, it will also be removed from the cluster configuration"},
5252
{"refresh", 0, 0, 'R', "\t(Advanced) Force the attrd daemon to resend all current values to the CIB\n"},
5353

54-
{"-spacer-",1, 0, '-', "\nAdditional options:\n"},
54+
{"-spacer-",1, 0, '-', "\nAdditional options:"},
55+
{"lifetime",1, 0, 'l', "Lifetime of the node attribute. Allowed values: forever, reboot"},
5556
{"delay", 1, 0, 'd', "The time to wait (dampening) in seconds further changes occur"},
5657
{"set", 1, 0, 's', "(Advanced) The attribute set in which to place the value"},
57-
{"section", 1, 0, 'S', "(Advanced) The section in which to place the value\n"},
58-
5958

6059
/* Legacy options */
6160
{"update", 1, 0, 'v', NULL, 1},
61+
{"section", 1, 0, 'S', NULL, 1},
6262
{0, 0, 0, 0}
6363
};
6464

@@ -70,7 +70,7 @@ main(int argc, char ** argv)
7070
int flag;
7171

7272
crm_log_init("attrd_updater", LOG_ERR, FALSE, FALSE, argc, argv);
73-
crm_set_options("?$Vn:v:d:s:S:RDQU:", "{command} -n {attribute} [options]", long_options, "Tool for updating cluster node attributes");
73+
crm_set_options("?$Vn:v:d:s:S:RDQU:l:", "command -n attribute [options]", long_options, "Tool for updating cluster node attributes");
7474

7575
if(argc < 2) {
7676
crm_help('?', LSB_EXIT_EINVAL);
@@ -98,6 +98,7 @@ main(int argc, char ** argv)
9898
case 'd':
9999
attr_dampen = crm_strdup(optarg);
100100
break;
101+
case 'l':
101102
case 'S':
102103
attr_section = crm_strdup(optarg);
103104
break;

tools/ccm_epoche.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ gboolean ccm_age_connect(int *ccm_fd);
6161

6262
static struct crm_option long_options[] = {
6363
/* Top-level Options */
64-
{"help", 0, 0, '?', "This text"},
65-
{"version", 0, 0, '$', "Version information" },
66-
{"verbose", 0, 0, 'V', "Increase debug output"},
67-
{"quiet", 0, 0, 'Q', "Essential output only"},
64+
{"help", 0, 0, '?', "\tThis text"},
65+
{"version", 0, 0, '$', "\tVersion information" },
66+
{"verbose", 0, 0, 'V', "\tIncrease debug output"},
67+
{"quiet", 0, 0, 'Q', "\tEssential output only"},
6868

6969
{"-spacer-", 1, 0, '-', "\nStack:", SUPPORT_HEARTBEAT},
7070
{"openais", 0, 0, 'A', "\tOnly try connecting to an OpenAIS-based cluster", SUPPORT_HEARTBEAT},
@@ -94,8 +94,8 @@ main(int argc, char ** argv)
9494

9595
crm_peer_init();
9696
crm_log_init(basename(argv[0]), LOG_WARNING, FALSE, FALSE, argc, argv);
97-
crm_set_options("?V$qepHR:s:SN:l:", "[-?$V] {command} [options]", long_options,
98-
"Tool for displaying node-level information");
97+
crm_set_options("?V$qepHR:s:SN:l:", "command [options]", long_options,
98+
"Tool for displaying low-level node information");
9999

100100
while (flag >= 0) {
101101
flag = crm_get_option(argc, argv, &option_index);

tools/cib_shadow.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,27 @@ static void shadow_teardown(char *name)
122122

123123
static struct crm_option long_options[] = {
124124
/* Top-level Options */
125-
{"help", 0, 0, '?', "This text"},
126-
{"version", 0, 0, '$', "Version information" },
127-
{"verbose", 0, 0, 'V', "Increase debug output\n"},
125+
{"help", 0, 0, '?', "\t\tThis text"},
126+
{"version", 0, 0, '$', "\t\tVersion information" },
127+
{"verbose", 0, 0, 'V', "\t\tIncrease debug output"},
128128

129-
{"create", required_argument, NULL, 'c', "\tCreate the named shadow copy of the active cluster configuration"},
130-
{"create-empty", required_argument, NULL, 'e', "Create the named shadow copy with an empty cluster configuration\n"},
131-
132-
{"which", no_argument, NULL, 'w', "\tIndicate the active shadow copy"},
133-
{"display", no_argument, NULL, 'p', "\tDisplay the contents of the shadow copy"},
134-
{"edit", no_argument, NULL, 'E', "\tEdit the contents of the named shadow copy with your favorite $EDITOR"},
135-
{"diff", no_argument, NULL, 'd', "\tDisplay the changes in the shadow copy\n"},
129+
{"-spacer-", 1, 0, '-', "\nQueries:"},
130+
{"which", no_argument, NULL, 'w', "\t\tIndicate the active shadow copy"},
131+
{"display", no_argument, NULL, 'p', "\t\tDisplay the contents of the shadow copy"},
132+
{"edit", no_argument, NULL, 'E', "\t\tEdit the contents of the named shadow copy with your favorite $EDITOR"},
133+
{"diff", no_argument, NULL, 'd', "\t\tDisplay the changes in the shadow copy\n"},
136134

137-
{"commit", required_argument, NULL, 'C', "Upload the contents of the named shadow copy to the cluster"},
138-
{"delete", required_argument, NULL, 'D', "Delete the contents of the named shadow copy"},
139-
{"reset", required_argument, NULL, 'r', "Recreate the named shadow copy from the active cluster configuration\n"},
135+
{"-spacer-", 1, 0, '-', "\nCommands:"},
136+
{"create", required_argument, NULL, 'c', "\tCreate the named shadow copy of the active cluster configuration"},
137+
{"create-empty", required_argument, NULL, 'e', "Create the named shadow copy with an empty cluster configuration"},
138+
{"commit", required_argument, NULL, 'C', "\tUpload the contents of the named shadow copy to the cluster"},
139+
{"delete", required_argument, NULL, 'D', "\tDelete the contents of the named shadow copy"},
140+
{"reset", required_argument, NULL, 'r', "\tRecreate the named shadow copy from the active cluster configuration"},
141+
{"switch", required_argument, NULL, 's', "\t(Advanced) Switch to the named shadow copy"},
140142

141-
{"force", no_argument, NULL, 'f', "\t(Advanced) Force the action to be performed"},
142-
{"batch", no_argument, NULL, 'b', "\t(Advanced) Don't spawn a new shell" },
143-
{"switch", required_argument, NULL, 's', "(Advanced) Switch to the named shadow copy"},
143+
{"-spacer-", 1, 0, '-', "\nAdditional Options:"},
144+
{"force", no_argument, NULL, 'f', "\t\t(Advanced) Force the action to be performed"},
145+
{"batch", no_argument, NULL, 'b', "\t\t(Advanced) Don't spawn a new shell" },
144146

145147
{0, 0, 0, 0}
146148
};
@@ -159,7 +161,7 @@ main(int argc, char **argv)
159161
int option_index = 0;
160162

161163
crm_log_init("crm_shadow", LOG_CRIT, FALSE, FALSE, argc, argv);
162-
crm_set_options("V$?bfwc:dr:C:D:ps:Ee:", NULL, long_options,
164+
crm_set_options("V$?bfwc:dr:C:D:ps:Ee:", "(query|command) [modifiers]", long_options,
163165
"Perform configuration changes in a sandbox before updating the live cluster.\n"
164166
" Sets up an environment in which configuration tools (cibadmin, crm_resource, etc) work"
165167
" offline instead of against a live cluster, allowing changes to be previewed and tested"

tools/cibadmin.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,28 @@ cib_t *the_cib = NULL;
7777
gboolean force_flag = FALSE;
7878

7979
static struct crm_option long_options[] = {
80-
{"help", 0, 0, '?', "This text"},
81-
{"version", 0, 0, '$', "Version information" },
82-
{"verbose", 0, 0, 'V', "Increase debug output\n"},
80+
{"help", 0, 0, '?', "\tThis text"},
81+
{"version", 0, 0, '$', "\tVersion information" },
82+
{"verbose", 0, 0, 'V', "\tIncrease debug output\n"},
8383

8484
{"-spacer-", 0, 0, '-', "Commands:"},
8585
{"upgrade", 0, 0, 'u', "\tUpgrade the configuration to the latest syntax"},
8686
{"query", 0, 0, 'Q', "\tQuery the contents of the CIB"},
8787
{"erase", 0, 0, 'E', "\tErase the contents of the whole CIB"},
88+
{"bump", 0, 0, 'B', "\tIncrease the CIB's epoch value by 1"},
8889
{"create", 0, 0, 'C', "\tCreate an object in the CIB. Will fail if the object already exists."},
8990
{"modify", 0, 0, 'M', "\tFind the object somewhere in the CIB's XML tree and update it. Fails if the object does not exist unless -c is specified"},
91+
{"patch", 0, 0, 'P', "\tSupply an update in the form of an xml diff (See also: crm_diff)"},
9092
{"replace", 0, 0, 'R', "\tRecursivly replace an object in the CIB"},
9193
{"delete", 0, 0, 'D', "\tDelete the first object matching the supplied criteria, Eg. <op id=\"rsc1_op1\" name=\"monitor\"/>"},
92-
{"-spacer-", 0, 0, '-', "\t\t\tThe tagname and all attributes must match in order for the element to be deleted"},
94+
{"-spacer-", 0, 0, '-', "\n\t\t\tThe tagname and all attributes must match in order for the element to be deleted"},
9395
{"md5-sum", 0, 0, '5', "\tCalculate a CIB digest"},
94-
{"patch", 0, 0, 'P', "\tSupply an update in the form of an xml diff (as produced by crm_diff)"},
95-
{"bump", 0, 0, 'B', "\tIncrease the CIB's epoch value by 1"},
96-
{"sync", 0, 0, 'S', "\tForce a refresh of the CIB to all nodes\n"},
96+
{"sync", 0, 0, 'S', "\t(Advanced) Force a refresh of the CIB to all nodes\n"},
9797
{"make-slave", 0, 0, 'r', NULL, 1},
9898
{"make-master", 0, 0, 'w', NULL, 1},
9999
{"is-master", 0, 0, 'm', NULL, 1},
100100

101-
{"-spacer-", 0, 0, '-', "Command Modifiers:"},
101+
{"-spacer-",1, 0, '-', "\nAdditional options:"},
102102
{"force", 0, 0, 'f'},
103103
{"timeout", 1, 0, 't', "Time (in seconds) to wait before declaring the operation failed"},
104104
{"sync-call", 0, 0, 's', "Wait for call to complete before returning"},
@@ -107,15 +107,15 @@ static struct crm_option long_options[] = {
107107
{"no-children", 0, 0, 'n', "(Advanced) When querying an object, do not return include its children in the result\n"},
108108
{"no-bcast", 0, 0, 'b', NULL, 1},
109109

110-
{"-spacer-", 0, 0, '-', "Command Data:"},
110+
{"-spacer-", 0, 0, '-', "Data:"},
111111
{"xml-text", 1, 0, 'X', "Retrieve XML from the supplied string"},
112112
{"xml-file", 1, 0, 'x', "Retrieve XML from the named file"},
113113
{"xml-pipe", 0, 0, 'p', "Retrieve XML from stdin\n"},
114114

115115
{"xpath", 1, 0, 'A', "A valid XPath to use instead of -o"},
116116
{"obj_type", 1, 0, 'o', "Limit the scope of the operation to a specific section of the CIB."},
117117
{"-spacer-", 0, 0, '-', "\t\t\tValid values are: nodes, resources, constraints, crm_config, rsc_defaults, op_defaults, status"},
118-
{"node", 1, 0, 'N', "\t(Advanced) Send command to the specified host\n"},
118+
{"node", 1, 0, 'N', "(Advanced) Send command to the specified host\n"},
119119

120120
{"-spacer-", 0, 0, '-', "\nExamples:\n"},
121121
{"-spacer-", 0, 0, '-', "cibadmin --query --local\t\t\t\tQuery the configuration from the local node\n"},
@@ -156,7 +156,7 @@ main(int argc, char **argv)
156156

157157
int option_index = 0;
158158
crm_log_init("cibadmin", LOG_CRIT, FALSE, FALSE, argc, argv);
159-
crm_set_options("V?$o:QDUCEX:t:Srwlsh:MmBfbRx:pP5N:A:unc", "command [modifiers] [data]", long_options,
159+
crm_set_options("V?$o:QDUCEX:t:Srwlsh:MmBfbRx:pP5N:A:unc", "command [options] [data]", long_options,
160160
"Provides direct access to the cluster configuration."
161161
"\n\n Allows the configuration, or sections of it, to be queried, modified, replaced and deleted."
162162
"\n\n Where necessary, XML data will be obtained using -X, -x, or -p options\n");

tools/crm_attribute.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,26 @@ const char *attr_default = NULL;
5454

5555
static struct crm_option long_options[] = {
5656
/* Top-level Options */
57-
{"help", 0, 0, '?', "This text"},
58-
{"version", 0, 0, '$', "Version information" },
59-
{"verbose", 0, 0, 'V', "Increase debug output\n"},
60-
{"quiet", 0, 0, 'Q', "Print only the value on stdout\n"},
57+
{"help", 0, 0, '?', "\tThis text"},
58+
{"version", 0, 0, '$', "\tVersion information" },
59+
{"verbose", 0, 0, 'V', "\tIncrease debug output"},
60+
{"quiet", 0, 0, 'Q', "\tPrint only the value on stdout\n"},
6161

62-
{"attr-name", 1, 0, 'n', "Name of the attribute/option to operate on\n"},
62+
{"name", 1, 0, 'n', "Name of the attribute/option to operate on"},
6363

6464
{"-spacer-", 0, 0, '-', "\nCommands:"},
65-
{"query", 0, 0, 'G', "Query the current value of the attribute/option"},
65+
{"query", 0, 0, 'G', "\tQuery the current value of the attribute/option"},
6666
{"update", 1, 0, 'v', "Update the value of the attribute/option"},
67-
{"delete", 0, 0, 'D', "Delete the attribute/option"},
67+
{"delete", 0, 0, 'D', "\tDelete the attribute/option"},
6868

69-
{"-spacer-", 0, 0, '-', "\nCommand Modifiers:"},
70-
{"node", 1, 0, 'N', "Set the value for a node other than this one"},
69+
{"-spacer-", 0, 0, '-', "\nAdditional Options:"},
70+
{"node", 1, 0, 'N', "Set an attribute for the named node (instead of a cluster option). See also: -l"},
7171
{"type", 1, 0, 't', "Which part of the configuration to update/delete/query the option in."},
72-
{"-spacer-", 0, 0, '-', "\tValid values: crm_config, rsc_defaults, op_defaults"},
72+
{"-spacer-", 0, 0, '-', "\t\t\tValid values: crm_config, rsc_defaults, op_defaults"},
7373
{"lifetime", 1, 0, 'l', "Lifetime of the node attribute."},
74-
{"-spacer-", 0, 0, '-', "\tValid values: reboot, forever"},
74+
{"-spacer-", 0, 0, '-', "\t\t\tValid values: reboot, forever"},
7575
{"set-name", 1, 0, 's', "(Advanced) The attribute set in which to place the value"},
76-
{"attr-id", 1, 0, 'i', "(Advanced) The ID used to identify the attribute"},
76+
{"id", 1, 0, 'i', "\t(Advanced) The ID used to identify the attribute"},
7777
{"default", 1, 0, 'd', "(Advanced) The default value to display if none is found in the configuration"},
7878

7979
{"inhibit-policy-engine", 0, 0, '!', NULL, 1},
@@ -84,7 +84,9 @@ static struct crm_option long_options[] = {
8484
{"get-value", 0, 0, 'G', NULL, 1},
8585
{"delete-attr", 0, 0, 'D', NULL, 1},
8686
{"attr-value", 1, 0, 'v', NULL, 1},
87-
87+
{"attr-name", 1, 0, 'n', NULL, 1},
88+
{"attr-id", 1, 0, 'i', NULL, 1},
89+
8890
{0, 0, 0, 0}
8991
};
9092

@@ -101,7 +103,7 @@ main(int argc, char **argv)
101103
int option_index = 0;
102104

103105
crm_log_init(basename(argv[0]), LOG_ERR, FALSE, FALSE, argc, argv);
104-
crm_set_options("V?$GDQN:U:u:s:n:v:l:t:i:!r:d:", "{command} -n {attribute} [-t|-l] [options]", long_options, "Manage node's attributes and cluster options."
106+
crm_set_options("V?$GDQN:U:u:s:n:v:l:t:i:!r:d:", "command -n attribute [options]", long_options, "Manage node's attributes and cluster options."
105107
"\n Allows node attributes and cluster options to be queried, modified and deleted.");
106108

107109
if(argc < 2) {

tools/crm_mon.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -223,32 +223,34 @@ int cib_connect(gboolean full)
223223

224224
static struct crm_option long_options[] = {
225225
/* Top-level Options */
226-
{"help", 0, 0, '?', "This text"},
227-
{"version", 0, 0, '$', "Version information" },
228-
{"verbose", 0, 0, 'V', "Increase debug output\n"},
229-
230-
{"interval", 1, 0, 'i', "Update frequency in seconds" },
231-
{"one-shot", 0, 0, '1', "\tDisplay the cluster status once on the console and exit (doesnt use ncurses)"},
232-
{"disable-ncurses",0, 0, 'N', "Disable the use of ncurses"},
233-
{"daemonize", 0, 0, 'd', "\tRun in the background as a daemon"},
234-
{"pid-file", 1, 0, 'p', "Daemon pid file location\n"},
226+
{"help", 0, 0, '?', "\tThis text"},
227+
{"version", 0, 0, '$', "\tVersion information" },
228+
{"verbose", 0, 0, 'V', "\tIncrease debug output"},
235229

230+
{"-spacer-", 1, 0, '-', "\nModes:"},
231+
{"as-html", 1, 0, 'h', "Write cluster status to the named file"},
232+
{"web-cgi", 0, 0, 'w', "\tWeb mode with output suitable for cgi"},
233+
{"simple-status", 0, 0, 's', "Display the cluster status once as a simple one line output (suitable for nagios)"},
234+
{"snmp-traps", 0, 0, 'S', "Send SNMP traps to this station"},
235+
{"mail-to", 1, 0, 'T', "Send Mail alerts to this user. See also --mail-from, --mail-host, --mail-prefix"},
236+
237+
{"-spacer-", 1, 0, '-', "\nDisplay Options:"},
236238
{"group-by-node", 0, 0, 'n', "Group resources by node" },
237-
{"inactive", 0, 0, 'r', "\tDisplay inactive resources" },
239+
{"inactive", 0, 0, 'r', "Display inactive resources" },
238240
{"failcounts", 0, 0, 'f', "Display resource fail counts"},
239241
{"operations", 0, 0, 'o', "Display resource operation history" },
240242
{"timing-details", 0, 0, 't', "Display resource operation history with timing details\n" },
241243

242-
{"snmp-traps", 0, 0, 'S', "Send SNMP traps to this station\n"},
244+
{"-spacer-", 1, 0, '-', "\nAdditional Options:"},
245+
{"interval", 1, 0, 'i', "\tUpdate frequency in seconds" },
246+
{"one-shot", 0, 0, '1', "\tDisplay the cluster status once on the console and exit (doesnt use ncurses)"},
247+
{"disable-ncurses",0, 0, 'N', "\tDisable the use of ncurses"},
248+
{"daemonize", 0, 0, 'd', "\tRun in the background as a daemon"},
249+
{"pid-file", 1, 0, 'p', "\t(Advanced) Daemon pid file location"},
250+
{"mail-from", 1, 0, 'F', "\tMail alerts should come from the named user"},
251+
{"mail-host", 1, 0, 'H', "\tMail alerts should be sent via the named host"},
252+
{"mail-prefix", 1, 0, 'P', "Subjects for mail alerts should start with this string"},
243253

244-
{"as-html", 1, 0, 'h', "Write cluster status to the named file"},
245-
{"web-cgi", 0, 0, 'w', "\tWeb mode with output suitable for cgi"},
246-
{"simple-status", 0, 0, 's', "Display the cluster status once as a simple one line output (suitable for nagios)\n"},
247-
248-
{"mail-to", 1, 0, 'T'},
249-
{"mail-from", 1, 0, 'F'},
250-
{"mail-host", 1, 0, 'H'},
251-
{"mail-prefix", 1, 0, 'P'},
252254

253255
{"xml-file", 1, 0, 'x', NULL, 1},
254256

@@ -267,7 +269,7 @@ main(int argc, char **argv)
267269
pid_file = crm_strdup("/tmp/ClusterMon.pid");
268270
crm_log_init(basename(argv[0]), LOG_CRIT, FALSE, FALSE, 0, NULL);
269271

270-
crm_set_options("V?$i:nrh:dp:s1wx:oftNS:T:F:H:P:", "[-?|-v|-1|-N|-d -p] [-h|-w|-s] [-S] [-T -F -H -P] [-i] [-n] [-r] [-f] [-o|-t]", long_options,
272+
crm_set_options("V?$i:nrh:dp:s1wx:oftNS:T:F:H:P:", "mode [options]", long_options,
271273
"Provides a summary of cluster's current state.\n Outputs varying levels of detail in a number of different formats.\n");
272274

273275
if (strcmp(crm_system_name, "crm_mon.cgi")==0) {

0 commit comments

Comments
 (0)