Skip to content
Snippets Groups Projects
Unverified Commit 11f11d7e authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

scripts: Don't trigger option hints for short options.

Previously, 'guix install foo -r bar' would crash with a backtrace
because NAME would be #\r (a character instead of a string).

* guix/scripts.scm (parse-command-line)[parse-options-from]: Call
'option-hint' only when NAME is a string.
parent e8fc3739
No related branches found
No related tags found
No related merge requests found
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Deck Pickard <deck.r.pickard@gmail.com> ;;; Copyright © 2014 Deck Pickard <deck.r.pickard@gmail.com>
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com> ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
...@@ -157,7 +157,8 @@ (define (parse-options-from args seeds) ...@@ -157,7 +157,8 @@ (define (parse-options-from args seeds)
;; Actual parsing takes place here. ;; Actual parsing takes place here.
(apply args-fold* args options (apply args-fold* args options
(lambda (opt name arg . rest) (lambda (opt name arg . rest)
(let ((hint (option-hint name options))) (let ((hint (and (string? name) ;not a short option
(option-hint name options))))
(report-error (G_ "~A: unrecognized option~%") name) (report-error (G_ "~A: unrecognized option~%") name)
(when hint (when hint
(display-hint (display-hint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment