From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YPlNEh4O2V7LSgAA0tVLHw (envelope-from ) for ; Thu, 04 Jun 2020 15:07:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SNwsDh4O2V7dWwAAB5/wlQ (envelope-from ) for ; Thu, 04 Jun 2020 15:07:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A957F9407C8 for ; Thu, 4 Jun 2020 15:07:09 +0000 (UTC) Received: from localhost ([::1]:44940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgrSW-0001Yw-Fi for larch@yhetil.org; Thu, 04 Jun 2020 11:07:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgrSR-0001Yc-02 for guix-patches@gnu.org; Thu, 04 Jun 2020 11:07:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgrSQ-0007rr-NH for guix-patches@gnu.org; Thu, 04 Jun 2020 11:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgrSQ-0006Dh-HS for guix-patches@gnu.org; Thu, 04 Jun 2020 11:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41253] [PATCH v3] guix repl: Add script execution. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Jun 2020 15:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41253 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Konrad Hinsen Cc: 41253@debbugs.gnu.org, zimoun Received: via spool by 41253-submit@debbugs.gnu.org id=B41253.159128319723874 (code B ref 41253); Thu, 04 Jun 2020 15:07:02 +0000 Received: (at 41253) by debbugs.gnu.org; 4 Jun 2020 15:06:37 +0000 Received: from localhost ([127.0.0.1]:47230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgrS1-0006D0-4R for submit@debbugs.gnu.org; Thu, 04 Jun 2020 11:06:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58182) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgrRz-0006Cn-4n for 41253@debbugs.gnu.org; Thu, 04 Jun 2020 11:06:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34209) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgrRt-0007c2-PH; Thu, 04 Jun 2020 11:06:29 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=46012 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jgrRi-000182-SZ; Thu, 04 Jun 2020 11:06:27 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200514162537.29071-1-zimon.toutoune@gmail.com> Date: Thu, 04 Jun 2020 17:06:16 +0200 In-Reply-To: (Konrad Hinsen's message of "Fri, 29 May 2020 12:11:26 +0200") Message-ID: <87img698gn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: MFVy7hhZ7wv7 Hello! Konrad Hinsen 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=E2=80=99s 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=3Dfoo.txt > +@end example I=E2=80=99d remove =E2=80=9C$=E2=80=9D 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=E2=80=99d 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 =E2=80=9Cscript=E2=80=9D is clearer than =E2=80=9Cscript-args=E2=80= =9D (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=E2=80=99re almost done. Thank you! Ludo=E2=80=99.