[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27820: guix package -u: order of argument is significant

From: Ricardo Wurmus
Subject: bug#27820: guix package -u: order of argument is significant
Date: Tue, 25 Jul 2017 23:23:40 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Ludovic Courtès <address@hidden> writes:

> Mark H Weaver <address@hidden> 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?


GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC

reply via email to

[Prev in Thread] Current Thread [Next in Thread]