Browse Source

dinit-monitor: re-word and fix formatting in documentation

Separate --str-failed/--str-stopped/--str-started documentation into one
paragraph for each.

Fix formatting so that each "--str-xxx" shows in bold in the man page.

Fix formatting in man page so that argument for "--str-xxx" is shown in
"italics" (\fIargument\fR) and not as <argument>. The latter isn't used
in man pages.

Fix "substituion" typo and reword. Use "text" in place of
programmer-centric "string" (though we leave the argument names as is).
Davin McCall 5 months ago
parent
commit
c3cb3bd693
2 changed files with 22 additions and 14 deletions
  1. 13 5
      doc/manpages/dinit-monitor.8.m4
  2. 9 9
      src/dinit-monitor.cc

+ 13 - 5
doc/manpages/dinit-monitor.8.m4

@@ -38,12 +38,20 @@ This option determines the default path to the control socket used to communicat
 (it does not override the \fB\-p\fR option).
 .TP
 \fB\-i\fR, \fB\-\-initial\fR
-Issue the specified command additionally for the initial status of a service.
-Otherwise, the command is only executed when the status changes for the first time.
+Issue the specified command additionally for the initial status of the services (when \fBdinit\-monitor\fR is started).
+Without this option, the command is only executed whenever service status changes.
 .TP
-\fB\-\-str\-started <str>\fR, \-\-str\-stopped <str>\fR, \-\-str\-failed <str>\fR
-Specify the string which gets used for the substituion of the status (\fB%s\fR) in the command.
-The default string is equivalent to the status name itself. (See \fB\-c\fR option)
+\fB\-\-str\-started\fR \fIstarted-text\fR\br\fB\-\-test\fR
+Specify the text used for the substitution of the status in the command (as specified
+by the \fB\-\-command\fR option) when a service starts.
+.TP
+\fB\-\-str\-stopped\fR \fIstopped-text\fR
+Specify the text used for the substitution of the status in the command (as specified
+by the \fB\-\-command\fR option) when a service stops.
+.TP
+\fB\-\-str\-failed\fR \fIfailed-text\fR
+Specify the text used for the substitution of the status in the command (as specified
+by the \fB\-\-command\fR option) when a service fails to start.
 .TP
 \fB\-\-socket\-path\fR \fIsocket-path\fR, \fB\-p\fR \fIsocket-path\fR
 Specify the path to the socket used for communicating with the service manager daemon.

+ 9 - 9
src/dinit-monitor.cc

@@ -83,7 +83,7 @@ int dinit_monitor_main(int argc, char **argv)
             else if (strcmp(argv[i], "--str-started") == 0) {
                 ++i;
                 if (i == argc) {
-                    std::cerr << "dinit-monitor: --str-started should be followed by a string\n";
+                    std::cerr << "dinit-monitor: --str-started should be followed by an argument\n";
                     return 1;
                 }
                 str_started = argv[i];
@@ -91,7 +91,7 @@ int dinit_monitor_main(int argc, char **argv)
             else if (strcmp(argv[i], "--str-stopped") == 0) {
                 ++i;
                 if (i == argc) {
-                    std::cerr << "dinit-monitor: --str-stopped should be followed by a string\n";
+                    std::cerr << "dinit-monitor: --str-stopped should be followed by an argument\n";
                     return 1;
                 }
                 str_stopped = argv[i];
@@ -99,7 +99,7 @@ int dinit_monitor_main(int argc, char **argv)
             else if (strcmp(argv[i], "--str-failed") == 0) {
                 ++i;
                 if (i == argc) {
-                    std::cerr << "dinit-monitor: --str-failed should be followed by a string\n";
+                    std::cerr << "dinit-monitor: --str-failed should be followed by an argument\n";
                     return 1;
                 }
                 str_failed = argv[i];
@@ -129,12 +129,12 @@ int dinit_monitor_main(int argc, char **argv)
                 "  -s, --system     : monitor system daemon (default if run as root)\n"
                 "  -u, --user       : monitor user daemon\n"
                 "  -i, --initial    : also execute command for initial service state\n"
-                "  --str-started <str>\n"
-                "                   : string substituted for %s when service is started\n"
-                "  --str-stopped <str>\n"
-                "                   : string substituted for %s when service is stopped\n"
-                "  --str-failed <str>\n"
-                "                   : string substituted for %s when service is failed\n"
+                "  --str-started <started-text>\n"
+                "                   : specify text describing status when service starts\n"
+                "  --str-stopped <stopped-text>\n"
+                "                   : specify text describing status when service stops\n"
+                "  --str-failed <failed-text>\n"
+                "                   : specify text describing status when service fails\n"
                 "  --socket-path <path>, -p <path>\n"
                 "                   : specify socket for communication with daemon\n"
                 "  -c, --command    : specify command to execute on service status change\n"