guix package: Warn when invoked with '-u -something'.

Fixes <https://bugs.gnu.org/27820>.
Reported by Hartmut Goebel <h.goebel@crazy-compilers.com>.

* guix/scripts/package.scm (%options) <"-u">: Emit a warning when ARG
starts with "-".
This commit is contained in:
Ludovic Courtès 2017-07-31 22:22:27 +02:00
parent a6b5af0cff
commit 6ddf97f81b
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

View File

@ -486,6 +486,11 @@ Install, remove, or upgrade packages in a single transaction.\n"))
arg-handler)))) arg-handler))))
(option '(#\u "upgrade") #f #t (option '(#\u "upgrade") #f #t
(lambda (opt name arg result arg-handler) (lambda (opt name arg result arg-handler)
(when (string-prefix? "-" arg)
(warning (G_ "upgrade regexp '~a' looks like a \
command-line option~%")
arg)
(warning (G_ "is this intended?~%")))
(let arg-handler ((arg arg) (result result)) (let arg-handler ((arg arg) (result result))
(values (alist-cons 'upgrade arg (values (alist-cons 'upgrade arg
;; Delete any prior "upgrade all" ;; Delete any prior "upgrade all"