Subject: [bug#40373] [PATCH] guix: new command "guix run-script"

From: zimoun <[email-masked]>
Date: Thu, 2 Apr 2020 11:17:19 +0200

Hi Konrad,

On Thu, 2 Apr 2020 at 09:14, Konrad Hinsen <[email-masked]> wrote:

> > What about making that just a new ‘-s’ flag for ‘guix repl’ (just like
> > Guile’s ‘-s’ flag)?  ‘-q’ should always be implied when doing that.
> >
> > Now, this wouldn’t be usable as a shebang due to the fact that only one
> > argument is allowed, unless we do some extra argument tokenizing.
>
> That is one reason why I opted for a separate command.
>
> The other is that I am in tutorial-driven development mode: I need "guix
> run-script" in order to be able to insert my own scripts (for analyzing
> dependencies) into a Guix tutorial for an upcoming MOOC. So I need to
> make sure that people can run my scripts easily, but also that they
> understand what they are doing. A command that does something else than
> its name suggests, with a similarity that is only visible to experts,
> is no good for use in a tutorial.
>
> BTW, I opted for a lengthy name ("run-script" rather than just "run" or
> "script") according to the principle that short words should be left for
> frequently used concepts (a principle respected by human languages, but
> also by Lisp tradition).
>
> I am of course aware that much of the code in "run-script" is the same
> as in "repl", which is not good. But I'd rather think about a better
> framework for code sharing among Guix scripts than about pushing too
> much semantic differences into obscure options. An example would be
> reusable "option clusters", such as "options for Guile" or "options for
> channels".

Initially, I thought the same as Ludo: "run-script" should be an
option to "repl". And I understand your UI concerns.

Maybe, we could deprecated "repl" and add "run" with:
 - guix run <file> (same than the "guix run-script" proposal)
 - guix run or guix run --repl doing the what "guix repl" does.

The new command "guix run" could have more or less the same option
than "guile" but prepending all the paths correctly. I mean we need
something like "guix name-it <otpions>" mimicking "guile <options>"
adding the correct Guix modules, IMHO.

BTW, thank you for this. Because it was missing in my toolbox and I
was annoyed until now.

Cheers,
simon