guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/01: Improve output of command-line errors.


From: Ludovic Courtès
Subject: [Guile-commits] 01/01: Improve output of command-line errors.
Date: Tue, 13 Jan 2015 08:30:23 +0000

civodul pushed a commit to branch stable-2.0
in repository guile.

commit e1d29ee4f7c06ceaf1d7c776bdb7e17b36c51825
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jan 13 09:30:08 2015 +0100

    Improve output of command-line errors.
    
    * module/ice-9/command-line.scm (shell-usage): Add 'newline' call when
      FMT is true.
      (compile-shell-switches)[error]: Prepend "error: " and append "~%" to
      FMT.
      Use a lower-case message.
---
 module/ice-9/command-line.scm |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index cd98c99..ba75064 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -1,6 +1,6 @@
 ;;; Parsing Guile's command-line
 
-;;; Copyright (C) 1994-1998, 2000-2011, 2012, 2013, 2014 Free Software 
Foundation, Inc.
+;;; Copyright (C) 1994-1998, 2000-2015 Free Software Foundation, Inc.
 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -147,8 +147,9 @@ If FILE begins with `-' the -s switch is mandatory.
   (let ((port (if fatal?
                   (current-error-port)
                   (current-output-port))))
-    (if fmt
-        (apply format port fmt args))
+    (when fmt
+      (apply format port fmt args)
+      (newline port))
 
     (format port (_ "Usage: ~a [OPTION]... [FILE]...\n") name)
     (display *usage* port)
@@ -203,7 +204,8 @@ If FILE begins with `-' the -s switch is mandatory.
         (turn-off-debugging? #f))
 
     (define (error fmt . args)
-      (apply shell-usage usage-name #t fmt args))
+      (apply shell-usage usage-name #t
+             (string-append "error: " fmt "~%") args))
 
     (define (parse args out)
       (cond
@@ -405,7 +407,7 @@ If FILE begins with `-' the -s switch is mandatory.
             (exit 0))
 
            (else
-            (error "Unrecognized switch ~a" arg)))))))
+            (error "unrecognized switch ~a" arg)))))))
 
     (define (finish args out)
       ;; Check to make sure the -ds got a -s.



reply via email to

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