all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Konrad Hinsen <konrad.hinsen@fastmail.net>
Cc: 41253@debbugs.gnu.org, zimoun <zimon.toutoune@gmail.com>
Subject: [bug#41253] [PATCH v3] guix repl: Add script execution.
Date: Thu, 04 Jun 2020 17:06:16 +0200	[thread overview]
Message-ID: <87img698gn.fsf@gnu.org> (raw)
In-Reply-To: <m1a71ryrsh.fsf@fastmail.net> (Konrad Hinsen's message of "Fri, 29 May 2020 12:11:26 +0200")

Hello!

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> * guix/scripts/repl.scm: Add filename options for script execution.
> * doc/guix.texi (Invoking guix repl): Document it.
> * tests/guix-repl.sh: Test it.

I like it!

It cannot be used as a shebang, can it?

There’s also the Makefile.am change that could be mentioned in the
commit log.

Some comments:

> +When at least one @var{files} argument is provided, @var{files} are
> +executed as Guile scripts in the given order:
> +
> +@example
> +$ guix repl my-script.scm
> +@end example
> +
> +To pass arguments to the script, use @code{--} to prevent them from
> +being interpreted as arguments to @command{guix repl} itself:
> +
> +@example
> +$ guix repl -- my-script.scm --input=foo.txt
> +@end example

I’d remove “$” from the examples.

> +Without any filename argument, a Guile REPL is started:

s/filename/file name/

>  @item -q
>  Inhibit loading of the @file{~/.guile} file.  By default, that
> -configuration file is loaded when spawning a @code{guile} REPL.
> +configuration file is loaded when executing scripts or spawning
> +a @code{guile} REPL.

I think this change is unnecessary (see below).

> +  (display (G_ "Usage: guix repl [OPTIONS...] [-- FILE ARGS...]
> +In the Guix execution environment, run FILE as a Guile script with
> +command-line arguments ARGS. If no FILE is given, start a Guile REPL,\n"))
                               ^                                       ^
Please add a space and change comma to period.

>                  (lambda (arg result)
> -                  (leave (G_ "~A: extraneous argument~%") arg))
> +                  (alist-cons 'script-args
> +                              (cons arg (cdr (assq 'script-args result)))
> +                              result))

I’d change that to just:

  (append `((script . ,arg) (ignore-dot-guile . #t)) result)

and later we can collect all the values associated with 'script.

I think “script” is clearer than “script-args” (and more in-line with
the naming conventions.)

Last but not least: I think -q should always be implied when running a
script.  ~/.guile is really meant for the REPL, nothing else.

> +  ;; Local Variables:
> +  ;; eval: (put 'call-with-connection 'scheme-indent-function 1)
> +  ;; End:
> +  )

Please move the comment to the bottom, outside the parens, as before,
otherwise this paren will feel lonely.  :-)

Thoughts?

Looks like we’re almost done.  Thank you!

Ludo’.




  reply	other threads:[~2020-06-04 15:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  9:18 [bug#41253] [PATCH] guix: add script execution to "guix repl" Konrad Hinsen
2020-05-14 16:25 ` [bug#41253] [PATCH v2] guix repl: Add script execution zimoun
2020-05-29 10:11   ` [bug#41253] [PATCH v3] " Konrad Hinsen
2020-06-04 15:06     ` Ludovic Courtès [this message]
2020-06-05  8:48       ` Konrad Hinsen
2020-06-05 10:18         ` Konrad Hinsen
2020-06-05 16:36         ` Ludovic Courtès
2020-06-06  5:22           ` Konrad Hinsen
2020-06-06  5:18     ` [bug#41253] [PATCH v4] " Konrad Hinsen
2020-06-12 15:58       ` Ludovic Courtès
2020-06-13 16:39         ` Konrad Hinsen
2020-06-13 19:44           ` Ludovic Courtès
2020-06-14  7:02             ` Konrad Hinsen
2020-06-13 16:34       ` [bug#41253] [PATCH v5] " Konrad Hinsen
2020-06-14  7:00         ` [bug#41253] [PATCH v6] " Konrad Hinsen
2020-06-14 20:50           ` bug#41253: " Ludovic Courtès
2020-05-14 16:31 ` [bug#41253] [PATCH] guix: add script execution to "guix repl" zimoun
2020-05-29 10:16   ` Konrad Hinsen
2020-05-29 13:53     ` zimoun
2020-05-29 17:21       ` Konrad Hinsen

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=87img698gn.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=41253@debbugs.gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    --cc=zimon.toutoune@gmail.com \
    /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.