From: Ricardo Wurmus <rekado@elephly.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 27820@debbugs.gnu.org, Hartmut Goebel <h.goebel@crazy-compilers.com>
Subject: bug#27820: guix package -u: order of argument is significant
Date: Tue, 25 Jul 2017 23:23:40 +0200 [thread overview]
Message-ID: <87eft46wir.fsf@elephly.net> (raw)
In-Reply-To: <8760egcjdc.fsf@gnu.org>
Ludovic Courtès <ludo@gnu.org> writes:
> 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:
>
> 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"
>
> Thoughts?
This seems good to me. I just wonder if there are legitimate cases
where a package regexp would look like a command line option. If that’s
not the case could we just “unread” the argument and parse it as the
next option?
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
next prev parent reply other threads:[~2017-07-25 21:24 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
2017-07-25 21:23 ` Ricardo Wurmus [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eft46wir.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=27820@debbugs.gnu.org \
--cc=h.goebel@crazy-compilers.com \
--cc=ludo@gnu.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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.