diff options
author | zimoun <[email protected]> | 2021-09-01 11:57:55 +0200 |
---|---|---|
committer | Ludovic Courtès <[email protected]> | 2021-09-07 15:59:34 +0200 |
commit | 1cf866c863e38bc2a61077e38f416fe3d310e340 (patch) | |
tree | 2c27538dff3aa8450a986d634127c28bce67d246 | |
parent | 96db2ff145ecbd962206eae815b065bda7ed3d9f (diff) |
import: Add hint for importer typo.
* guix/scripts/import.scm (define-command): Add hint.
Signed-off-by: Ludovic Courtès <[email protected]>
-rw-r--r-- | guix/scripts/import.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index b369a362d0..11e94769bb 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014 David Thompson <[email protected]> ;;; Copyright © 2018 Kyle Meyer <[email protected]> ;;; Copyright © 2019 Ricardo Wurmus <[email protected]> +;;; Copyright © 2021 Simon Tournier <[email protected]> ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,4 +131,9 @@ Run IMPORTER with ARGS.\n")) expressions)) (x (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)))))) |