import: Add hint for importer typo.
* guix/scripts/import.scm (define-command): Add hint. Signed-off-by: Ludovic Courtès <ludo@gnu.org>master
parent
96db2ff145
commit
1cf866c863
|
@ -3,6 +3,7 @@
|
||||||
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
||||||
;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
|
;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
|
||||||
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
|
||||||
|
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -130,4 +131,9 @@ Run IMPORTER with ARGS.\n"))
|
||||||
expressions))
|
expressions))
|
||||||
(x
|
(x
|
||||||
(leave (G_ "'~a' import failed~%") importer))))
|
(leave (G_ "'~a' import failed~%") importer))))
|
||||||
(leave (G_ "~a: invalid importer~%") importer)))))
|
(let ((hint (string-closest importer importers #:threshold 3)))
|
||||||
|
(report-error (G_ "~a: invalid importer~%") importer)
|
||||||
|
(when hint
|
||||||
|
(display-hint
|
||||||
|
(format #f (G_ "Did you mean @code{~a}?~%") hint)))
|
||||||
|
(exit 1))))))
|
||||||
|
|
Reference in New Issue