1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-30 15:00:21 +02:00

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.
This commit is contained in:
Ludovic Courtès 2015-01-13 09:30:08 +01:00
parent 01a301d1b6
commit e1d29ee4f7

View file

@ -1,6 +1,6 @@
;;; Parsing Guile's command-line ;;; 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 ;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public ;;;; 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? (let ((port (if fatal?
(current-error-port) (current-error-port)
(current-output-port)))) (current-output-port))))
(if fmt (when fmt
(apply format port fmt args)) (apply format port fmt args)
(newline port))
(format port (_ "Usage: ~a [OPTION]... [FILE]...\n") name) (format port (_ "Usage: ~a [OPTION]... [FILE]...\n") name)
(display *usage* port) (display *usage* port)
@ -203,7 +204,8 @@ If FILE begins with `-' the -s switch is mandatory.
(turn-off-debugging? #f)) (turn-off-debugging? #f))
(define (error fmt . args) (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) (define (parse args out)
(cond (cond
@ -405,7 +407,7 @@ If FILE begins with `-' the -s switch is mandatory.
(exit 0)) (exit 0))
(else (else
(error "Unrecognized switch ~a" arg))))))) (error "unrecognized switch ~a" arg)))))))
(define (finish args out) (define (finish args out)
;; Check to make sure the -ds got a -s. ;; Check to make sure the -ds got a -s.