guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 02/03: 'herd help' displays a help message.


From: Ludovic Courtès
Subject: [shepherd] 02/03: 'herd help' displays a help message.
Date: Sun, 24 Jan 2016 23:11:11 +0000

civodul pushed a commit to branch master
in repository shepherd.

commit 9184e3cb0c0095f3aaf047be05855464e8ea7bbc
Author: Ludovic Courtès <address@hidden>
Date:   Sun Jan 24 22:53:02 2016 +0100

    'herd help' displays a help message.
    
    * modules/shepherd/service.scm (root-service): Add 'help' action.
    * modules/herd.scm (run-command): Add special-case for 'help'.
    (main): Allow 'herd help' without a service name.
---
 modules/herd.scm             |    7 ++++++-
 modules/shepherd/service.scm |   14 ++++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/modules/herd.scm b/modules/herd.scm
index a5e6c16..7075ace 100644
--- a/modules/herd.scm
+++ b/modules/herd.scm
@@ -115,6 +115,11 @@ the daemon via SOCKET-FILE."
            (display-status-summary (first result)))
           (('detailed-status (or 'root 'shepherd))
            (display-detailed-status (first result)))
+          (('help (or 'root 'shepherd))
+           (match result
+             ((help-text)
+              (display (gettext help-text))
+              (newline))))
           (('status _)
            ;; We get a list of statuses, in case several services have the
            ;; same name.
@@ -168,7 +173,7 @@ talking to shepherd"))
                                  (set! socket-file file))))
 
       (match (reverse command-args)
-        (((and action (or "status" "detailed-status"))) ;one argument
+        (((and action (or "status" "detailed-status" "help"))) ;one argument
          (run-command socket-file (string->symbol action) 'root '()))
         ((action service args ...)
          (run-command socket-file
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 1c280aa..cf72f8b 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1070,6 +1070,20 @@ file when persistence is enabled."
     ;; allowed to quit, while user-supplied code shouldn't be.
     #:actions
     (make-actions
+     (help
+      "Show the help message for the 'root' service."
+      (lambda _
+        ;; A rudimentary attempt to have 'herd help' return something
+        ;; sensible.
+        "\
+This is the help message for the 'root' service of the Shepherd.  The 'root'
+service is used to control the Shepherd itself and it supports several
+actions.  For instance, running 'herd status root' or simply 'herd status'
+returns a summary of each service.
+
+Try 'herd doc root list-actions' to see the list of available actions.
+Run 'info shepherd' to access the user manual."))
+
      (status
       "Return an s-expression showing information about all the services.
 Clients such as 'herd' can read it and format it in a human-readable way."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]