unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: Hartmut Goebel <h.goebel@crazy-compilers.com>, 27820@debbugs.gnu.org
Subject: bug#27820: guix package -u: order of argument is significant
Date: Tue, 25 Jul 2017 23:11:11 +0200	[thread overview]
Message-ID: <8760egcjdc.fsf@gnu.org> (raw)
In-Reply-To: <87fudkb8zm.fsf@netris.org> (Mark H. Weaver's message of "Tue, 25 Jul 2017 15:40:45 -0400")

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Mark H Weaver <mhw@netris.org> skribis:

> I agree that this is quite confusing.  Perhaps we should issue a warning
> if the regexp begins with "-".
>
> Also, perhaps we should *always* require an argument after "-u", even if
> "-u" is at the end of the command line, failing otherwise.  Users would
> then learn to always pass an argument to "-u", and thus would be less
> likely to fall into this trap when adding more options after the "-u".

I’m in favor of the former:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 835 bytes --]

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 8da7a3fd3..b6133b6af 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -486,6 +486,11 @@ Install, remove, or upgrade packages in a single transaction.\n"))
                              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"

[-- Attachment #3: Type: text/plain, Size: 25 bytes --]


Thoughts?

Ludo’.

  reply	other threads:[~2017-07-25 21:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 11:19 bug#27820: guix package -u: order of argument is significant Hartmut Goebel
2017-07-25 19:40 ` Mark H Weaver
2017-07-25 21:11   ` Ludovic Courtès [this message]
2017-07-25 21:23     ` Ricardo Wurmus
2017-07-26  8:14       ` Ludovic Courtès
2017-07-26  8:59         ` Ricardo Wurmus
2017-07-26 17:58           ` Mark H Weaver
2017-07-31 21:07             ` Ludovic Courtès
2017-07-26 20:49           ` Alex Kost
2017-07-26  8:28   ` Hartmut Goebel
2017-07-26  9:03     ` Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760egcjdc.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=27820@debbugs.gnu.org \
    --cc=h.goebel@crazy-compilers.com \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).