summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-01-13 09:30:08 +0100
committerLudovic Courtès <ludo@gnu.org>2015-01-13 09:30:08 +0100
commite1d29ee4f7c06ceaf1d7c776bdb7e17b36c51825 (patch)
treed3457a7b0524e4255bb0be8914f0972395823185
parent01a301d1b606b84d986b735049e7155d2f4cd6aa (diff)
downloadguile-e1d29ee4f7c06ceaf1d7c776bdb7e17b36c51825.tar.gz
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.
-rw-r--r--module/ice-9/command-line.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index cd98c9904..ba75064da 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.