guix-commits
[Top][All Lists]
Advanced

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

[shepherd] branch master updated: herd: Suggest alternatives when action


From: Ludovic Courtès
Subject: [shepherd] branch master updated: herd: Suggest alternatives when action and service are likely swapped.
Date: Fri, 02 Jun 2023 10:03:41 -0400

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch master
in repository shepherd.

The following commit(s) were added to refs/heads/master by this push:
     new b9b15db  herd: Suggest alternatives when action and service are likely 
swapped.
b9b15db is described below

commit b9b15db9e5bda27287706b6727c462df686e7621
Author: Liliana Marie Prikler <liliana.prikler@gmail.com>
AuthorDate: Wed Dec 2 10:21:07 2020 +0100

    herd: Suggest alternatives when action and service are likely swapped.
    
    * modules/shepherd/script/herd.scm (run-command)[reply error]: Report a more
    descriptive error if service could reasonably have been an action.
    
    Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 NEWS                              |  6 ++++++
 modules/shepherd/scripts/herd.scm | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/NEWS b/NEWS
index 04bba81..d6c2fc0 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,12 @@ Copyright © 2013-2014, 2016, 2018-2020, 2022-2023 Ludovic 
Courtès <ludo@gnu.or
 
 Please send Shepherd bug reports to bug-guix@gnu.org.
 
+* Changes in 0.10.2
+
+** ‘herd’ shows a hint when the service and action are likely swapped
+
+The hint is printed for instance when typing ‘herd foobar start’.
+
 * Changes in 0.10.1
 
 ** Configurable number of ‘bind’ attempts for endpoints
diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 9891498..04d8be7 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -478,6 +478,18 @@ the daemon via SOCKET-FILE."
                 ('messages messages))
         (for-each display-line messages)
         (report-command-error error)
+
+        ;; Did the user swap ACTION and SERVICE?
+        (match (list action service)
+          ((_ (or 'start 'stop 'status 'doc))
+           (report-error (l10n "Did you mean 'herd ~a ~a'?")
+                         service action))
+          ((root (or 'help 'halt 'power-off 'load 'eval 'unload 'reload
+                     'daemonize 'restart))
+           (report-error (l10n "Did you mean 'herd ~a ~a'?")
+                         service action))
+          ((_ _) *unspecified*))
+
         (exit 1))
        ((? eof-object?)
         ;; When stopping shepherd, we may get an EOF in lieu of a real reply,



reply via email to

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