[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 02/08: service: Turn 'doc' method into a procedure.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 02/08: service: Turn 'doc' method into a procedure. |
Date: |
Thu, 13 Apr 2023 05:43:11 -0400 (EDT) |
civodul pushed a commit to branch wip-goopsless
in repository shepherd.
commit d672aa021f17825c4ee01825413ef9181a2e9751
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 a02398c..7fe1b5b 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -77,7 +77,6 @@
start-in-the-background
stop
action
- doc
for-each-service
respawn-service
@@ -869,7 +868,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.
@@ -908,34 +907,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'."))))))
- [shepherd] branch wip-goopsless updated (a353fa5 -> 89853a3), Ludovic Courtès, 2023/04/13
- [shepherd] 07/08: squash! service: Use 'lookup-service' instead of 'lookup-services'., Ludovic Courtès, 2023/04/13
- [shepherd] 05/08: service: Turn 'start' method into a procedure., Ludovic Courtès, 2023/04/13
- [shepherd] 03/08: service: Turn 'action' method into a procedure., Ludovic Courtès, 2023/04/13
- [shepherd] 08/08: service: 'stop-service' returns the list of stopped services, not names., Ludovic Courtès, 2023/04/13
- [shepherd] 01/08: monitoring: Log registered service names., Ludovic Courtès, 2023/04/13
- [shepherd] 02/08: service: Turn 'doc' method into a procedure.,
Ludovic Courtès <=
- [shepherd] 04/08: squash! service: Use 'lookup-service' instead of 'lookup-services'., Ludovic Courtès, 2023/04/13
- [shepherd] 06/08: service: Turn 'stop' method into a procedure., Ludovic Courtès, 2023/04/13