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 ixp8G0QH2l6sYwAA0tVLHw (envelope-from ) for ; Fri, 05 Jun 2020 08:50:12 +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 sBEOF0QH2l5qcAAAB5/wlQ (envelope-from ) for ; Fri, 05 Jun 2020 08:50:12 +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 3BE2D9401CD for ; Fri, 5 Jun 2020 08:50:11 +0000 (UTC) Received: from localhost ([::1]:56158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh83F-0004K0-Rf for larch@yhetil.org; Fri, 05 Jun 2020 04:50:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh838-0004Jq-4o for guix-patches@gnu.org; Fri, 05 Jun 2020 04:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jh837-0003ZA-Rh for guix-patches@gnu.org; Fri, 05 Jun 2020 04:50:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jh837-00036k-PL for guix-patches@gnu.org; Fri, 05 Jun 2020 04:50:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41253] [PATCH v3] guix repl: Add script execution. Resent-From: Konrad Hinsen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 05 Jun 2020 08:50:01 +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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 41253@debbugs.gnu.org, zimoun Received: via spool by 41253-submit@debbugs.gnu.org id=B41253.159134694311873 (code B ref 41253); Fri, 05 Jun 2020 08:50:01 +0000 Received: (at 41253) by debbugs.gnu.org; 5 Jun 2020 08:49:03 +0000 Received: from localhost ([127.0.0.1]:48294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jh82B-00035R-5i for submit@debbugs.gnu.org; Fri, 05 Jun 2020 04:49:03 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:54399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jh829-00034x-J1 for 41253@debbugs.gnu.org; Fri, 05 Jun 2020 04:49:01 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id B1F28953; Fri, 5 Jun 2020 04:48:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 05 Jun 2020 04:48:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= pmHSnFMb8j/7AGQvFjQbA/yKfDaPzkZrc7eUP4HCHAg=; b=vmm3wg97b3LHBGul 5IOarFQOPwYfIT4RSF2uIv3Gk2vBP6j4Pa1TfKam59G0A8O2indlI2FfbopIA1Uk r0AYiYjLZdjX5Oinumks+uOi6EtaNNimCLtMVQvs4l3oxLxoFMB84HJem7tX7Gv1 5HqL3/lFgTxfF7lbnKfLQjj6jeCz2t/PbKJsKmKp+ulVz3YWMZduKVMntwNU5suu 0d/NuM+hxZhFZs+cuopP7HehFSHZVMLEGSzVREFnMIqI+A+CLs4xRKz+qHnr6xOc gspGNdpztccSZuSD0q3QKOAa9RpedHKQrh/6CF6ljpGxmxxiFtfVPzdg/TpB/N6o udCbIQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=pmHSnFMb8j/7AGQvFjQbA/yKfDaPzkZrc7eUP4HCH Ag=; b=bKPZLO95GP1hlexRhYu4cKJX691gY7emxdCBv2iusLUIxDQCKKZYrAIDx evLpQF3PAYE/4Pxq6weePjS5pDTN8x4l4UgDvZHg5sqneThYnjf/0XWLgcDsV3A8 /bptyN9PgLeA4YdBJAEiapb/zTrFzclGnbVtzKOHPQvJoYl0JjngCtm9MotlXqt8 LtvgAYzIw2ZCtIrC/UGoGcgDmQcut7aFveB2agPQE6q02ZFiAAfCwHfmDMB4QP7B GBplcoORRe8U1uXXReWR0uZjnTO9aJ7slrFTvleMVtR+uPcrzNdZKdV+q9kLr5dc pRSGXR6N3hnsYmapP7AR/QgQPmp5Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudegfedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpefmohhnrhgr ugcujfhinhhsvghnuceokhhonhhrrggurdhhihhnshgvnhesfhgrshhtmhgrihhlrdhnvg htqeenucggtffrrghtthgvrhhnpeevheelveegjeduvdfgudeifeevteffvdetgeefkefg udeujeefgedvheegkefhjeenucfkphepledvrdduieelrddujeefrddvvdehnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhonhhrrggurdhh ihhnshgvnhesfhgrshhtmhgrihhlrdhnvght X-ME-Proxy: Received: from khs-macbook.home (lfbn-idf2-1-1364-225.w92-169.abo.wanadoo.fr [92.169.173.225]) by mail.messagingengine.com (Postfix) with ESMTPA id 94D16328005A; Fri, 5 Jun 2020 04:48:54 -0400 (EDT) From: Konrad Hinsen In-Reply-To: <87img698gn.fsf@gnu.org> References: <20200514162537.29071-1-zimon.toutoune@gmail.com> <87img698gn.fsf@gnu.org> Date: Fri, 05 Jun 2020 10:48:53 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) 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=fail (rsa verify failed) header.d=fastmail.net header.s=fm3 header.b=vmm3wg97; dkim=fail (rsa verify failed) header.d=messagingengine.com header.s=fm3 header.b=bKPZLO95; dmarc=fail reason="SPF not aligned (relaxed)" header.from=fastmail.net (policy=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: 0.09 X-TUID: CIyM1zNCfRzd 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: =3D=3D=3D=3D=3D File foo.scm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D #!/usr/bin/env -S guix repl !# (use-modules (ice-9 format)) (format #t "foo called with arguments: ~s\n"(command-line)) =3D=3D=3D=3D=3D End of file foo.scm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 '=E2=80=93' 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 =E2=80=93. 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=3Dfoo.txt >> +@end example > > I=E2=80=99d remove =E2=80=9C$=E2=80=9D 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