guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 03/13: service: Turn 'doc' method into a procedure.


From: Ludovic Courtès
Subject: [shepherd] 03/13: service: Turn 'doc' method into a procedure.
Date: Sun, 16 Apr 2023 17:38:36 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 853d1a0eb357f2e8c02d0e0848363320055f8926
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Apr 11 21:46:09 2023 +0200

    service: Turn 'doc' method into a procedure.
    
    * modules/shepherd/service.scm (doc): Rename to...
    (display-service-documentation): ... this.  Turn into a regular
    procedure.  Keep private.
    (action): Adjust accordingly.
---
 modules/shepherd/service.scm | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 60e8f79..769828f 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -77,7 +77,6 @@
             start-in-the-background
             stop
             action
-            doc
 
             lookup-running
             for-each-service
@@ -870,7 +869,7 @@ is not already running, and will return SERVICE's canonical 
name in a list."
                        (service-canonical-name obj))))
       ((doc)
        (lambda (_ . args)
-         (apply doc obj args)))
+         (apply display-service-documentation obj args)))
       (else
        (lambda _
          ;; FIXME: Unknown service.
@@ -909,34 +908,34 @@ is not already running, and will return SERVICE's 
canonical name in a list."
                (report-exception the-action obj key args)))))))
 
 ;; Display documentation about the service.
-(define-method (doc (obj <service>) . args)
+(define (display-service-documentation service . args)
   (if (null? args)
       ;; No further argument given -> Normal level of detail.
-      (local-output (service-documentation obj))
+      (local-output (service-documentation service))
     (case (string->symbol (car args)) ;; Does not work with strings.
       ((full)
        ;; FIXME
-       (local-output (service-documentation obj)))
+       (local-output (service-documentation service)))
       ((short)
        ;; FIXME
-       (local-output (service-documentation obj)))
+       (local-output (service-documentation service)))
       ((action)
        ;; Display documentation of given actions.
        (for-each
        (lambda (the-action)
           (let ((action-object
-                 (lookup-service-action obj (string->symbol the-action))))
+                 (lookup-service-action service (string->symbol the-action))))
             (unless action-object
               (raise (condition (&unknown-action-error
                                  (action the-action)
-                                 (service obj)))))
+                                 (service service)))))
             (local-output "~a: ~a" the-action
                           (action-documentation action-object))))
         (cdr args)))
       ((list-actions)
        (local-output "~a ~a"
-                    (service-canonical-name obj)
-                    (action-list obj)))
+                    (service-canonical-name service)
+                    (action-list service)))
       (else
        ;; FIXME: Implement doc-help.
        (local-output (l10n "Unknown keyword.  Try 'doc root help'."))))))



reply via email to

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