From: Konrad Hinsen <konrad.hinsen@fastmail.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 41253@debbugs.gnu.org, zimoun <zimon.toutoune@gmail.com>
Subject: [bug#41253] [PATCH v3] guix repl: Add script execution.
Date: Fri, 05 Jun 2020 10:48:53 +0200 [thread overview]
Message-ID: <m1wo4lkidm.fsf@khs-macbook.home> (raw)
In-Reply-To: <87img698gn.fsf@gnu.org>
Hi Ludo,
Thanks for your feedback!
> It cannot be used as a shebang, can it?
It can. And that might be worth documenting. Here's an example:
===== File foo.scm =========================================
#!/usr/bin/env -S guix repl
!#
(use-modules (ice-9 format))
(format #t "foo called with arguments: ~s\n"(command-line))
===== End of file foo.scm ==================================
hinsen@guix ~$ ~/foo.scm a b c
;;; note: source file /home/hinsen/temp/foo.scm
;;; newer than compiled /home/hinsen/.cache/guile/ccache/3.0-LE-8-4.2/home/hinsen/temp/foo.scm.go
foo called with arguments: ("/home/hinsen/temp/foo.scm" "a" "b" "c")
The ugly part is that the script needs to be called with '–' as its
first argument if any of the following arguments start with dashes:
hinsen@guix ~$ ~/foo.scm -- --help
;;; note: source file /home/hinsen/temp/foo.scm
;;; newer than compiled /home/hinsen/.cache/guile/ccache/3.0-LE-8-4.2/home/hinsen/temp/foo.scm.go
foo called with arguments: ("/home/hinsen/temp/foo.scm" "--help")
That could be fixed at the price of a command line interface for "guix
repl" that deviates a bit from Guix conventions. For example,
is there's a file name argument, pass all arguments following it to the
script, eliminating the need for –.
I'll try that in a v4, and also take into account all your remaining
remarks. Just one note on the examples:
>> +@example
>> +$ guix repl -- my-script.scm --input=foo.txt
>> +@end example
>
> I’d remove “$” from the examples.
There are many examples in guix.texi with $, and also many without. Plus
some with # as the command line prompt.
It makes sense to add the command line prompt for examples that also
show output, so I am not sure what the best convention is - but it would
be nice to apply a uniform style everywhere (but NOT as part of
this patch, of course).
Cheers,
Konrad
next prev parent reply other threads:[~2020-06-05 8:50 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
2020-06-05 8:48 ` Konrad Hinsen [this message]
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=m1wo4lkidm.fsf@khs-macbook.home \
--to=konrad.hinsen@fastmail.net \
--cc=41253@debbugs.gnu.org \
--cc=ludo@gnu.org \
--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.