guix-commits
[Top][All Lists]
Advanced

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

[shepherd] branch main updated: args: Insert newline when display doc fo


From: Ludovic Courtès
Subject: [shepherd] branch main updated: args: Insert newline when display doc for long options.
Date: Wed, 04 Dec 2024 05:48:25 -0500

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

civodul pushed a commit to branch main
in repository shepherd.

The following commit(s) were added to refs/heads/main by this push:
     new 9574311  args: Insert newline when display doc for long options.
9574311 is described below

commit 9574311ca2e5228480cd38ca5c46be181f91dfcf
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Dec 4 11:41:04 2024 +0100

    args: Insert newline when display doc for long options.
    
    Fixes a bug visible with the addition of long options to ‘herd’ in
    commit 8ca0db6f41c3e4d281fb75cba7e8c7da5b32df0b whereby the option
    synopsis and its spec would be stuck to one another in the output of
    ‘herd --help’.
    
    * modules/shepherd/args.scm (display-doc)[fill-to]: Insert newline when
    COL is greater than or equal to TARGET-COL.
---
 modules/shepherd/args.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/shepherd/args.scm b/modules/shepherd/args.scm
index 0c5bb1d..43ca530 100644
--- a/modules/shepherd/args.scm
+++ b/modules/shepherd/args.scm
@@ -87,8 +87,13 @@ characteristics."
       (set! col (+ col (string-length text)))
       (display text))
     (define (fill-to target-col)
-      (while (< col target-col)
-            (output (string #\space))))
+      (if (>= col target-col)
+          (begin
+            (set! col 0)
+            (newline)
+            (fill-to target-col))
+          (while (< col target-col)
+           (output (string #\space)))))
 
     (fill-to 2)
     (when (option-short-name opt)



reply via email to

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