guix-patches
[Top][All Lists]
Advanced

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

[bug#64173] [PATCH 0/1] guix: pack: add --entry-point-argument option


From: Simon Tournier
Subject: [bug#64173] [PATCH 0/1] guix: pack: add --entry-point-argument option
Date: Thu, 17 Aug 2023 13:48:33 +0200

Hi,

On Thu, 17 Aug 2023 at 11:42, Ludovic Courtès <ludo@gnu.org> wrote:

>> +(define (entry-point-argument-spec-option-parser opt name arg result)
>> +  "A SRFI-37 opion parser for the --entry-point-argument option. The spec
>> +takes multiple occurances. The entries are used in the exec form for the
>> +docker entry-point. The values are used as parameters in conjunction with
>> +the --entry-point option which is used as the first value in the exec form."
>> +  (let ((entry-point-argument (assoc-ref result 'entry-point-argument)))
>> +    (alist-cons 'entry-point-argument
>> +                (append entry-point-argument (list arg))
>> +                (alist-delete 'entry-point-argument result eq?))))
>
> I would just keep a regular option parser that does:
>
>   (alist-cons 'entry-point-argument arg result)
>
> Later on, we’d collect all these arguments:
>
>   (reverse
>    (filter-map (match-lambda
>                 (('entry-point-argument . arg) arg)
>                 (_ #f))
>                opts))
>
> I think this would be a bit clearer; this is what ‘guix repl’ does, for
> instance.

[...]

> This can be omitted if you take the approach suggested above, with one
> ‘entry-point-argument’ pair per argument.

[...]

> This would become #:entry-point-arguments (plural), with the
> ‘filter-map’ trick shown above.

Just to be sure to understand, the command-line could list several
--entry-point-argument options, right?

Well, since the order of the various command-line arguments might
matter, and since a ’reverse’ is suggested, and since all the Guix
command-lines do not behave the same way – for instance “guix package”
processes command-line argument from right to left; see #43585 or #50473
[1,2]; anyway :-) – I would suggest to add a sentence in the
documentation (manual) that the command-line arguments are parsed from
left to right.


1: https://issues.guix.gnu.org/issue/43585
2: https://issues.guix.gnu.org/issue/50473


Cheers,
simon





reply via email to

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