From 6ddf97f81bb99a73f00e30ad5fc19577872b5b49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Mon, 31 Jul 2017 22:22:27 +0200
Subject: [PATCH] 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 "-".
---
 guix/scripts/package.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 8da7a3fd3af..b6133b6af0f 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -486,6 +486,11 @@ (define %options
                              arg-handler))))
          (option '(#\u "upgrade") #f #t
                  (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))
                      (values (alist-cons 'upgrade arg
                                          ;; Delete any prior "upgrade all"
-- 
GitLab