From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kAeKOEqiimOsmAAAbAwnHQ (envelope-from ) for ; Sat, 03 Dec 2022 02:11:39 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id gNOmN0qiimNsGAEAG6o9tA (envelope-from ) for ; Sat, 03 Dec 2022 02:11:38 +0100 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 97869B88C for ; Sat, 3 Dec 2022 02:11:38 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1H3Z-00085z-Uo; Fri, 02 Dec 2022 20:11:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1H3W-00085W-RW for guix-patches@gnu.org; Fri, 02 Dec 2022 20:11:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1H3W-0007LL-Fl for guix-patches@gnu.org; Fri, 02 Dec 2022 20:11:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p1H3W-0008MA-Aq for guix-patches@gnu.org; Fri, 02 Dec 2022 20:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59754] [PATCH 2/2] scripts: repl: Add -i, --interactive flag. Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 03 Dec 2022 01:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59754 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59754@debbugs.gnu.org Cc: Antero Mejr Received: via spool by 59754-submit@debbugs.gnu.org id=B59754.167002981632104 (code B ref 59754); Sat, 03 Dec 2022 01:11:02 +0000 Received: (at 59754) by debbugs.gnu.org; 3 Dec 2022 01:10:16 +0000 Received: from localhost ([127.0.0.1]:49993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1H2m-0008Lj-4Q for submit@debbugs.gnu.org; Fri, 02 Dec 2022 20:10:16 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:57560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1H2i-0008LL-Ra for 59754@debbugs.gnu.org; Fri, 02 Dec 2022 20:10:14 -0500 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4NPBYl0jxZz9sQD for <59754@debbugs.gnu.org>; Sat, 3 Dec 2022 02:10:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1670029803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1AU0GE+RCcx8cgEO9gmVOjkaGomeUtyAJMm7LWLtAo8=; b=mNHJ6so/sNtt2zfb65rybkbcIpVHHcZJup+7NMklg5eO6SdUcTTxsrp8WhCJYoHxquCMnK eL6hxDcRbrEjdhNPrA+uydLNA+8hwgpLvuOMjviOG1HCgcdHU7fJ9jJDh27SDtZQljt/7k MxYrTV/WVA4+F+0uHpGEsUSIb1n+TPHU9VBJxwpf0ZjHDViFwsDIm0ulLGPXW+Gcmt6mL0 YB+ri3/5NjT7IVA5nYbbqKH5vUW9jOqQRcKlyikrkja2d4KTNLwkdNtbzRyEcT5v1AfpX9 KQLEIA9cPyA1pH/bYoMNBg56cORufO0JeMqgKGwAqpHDmrmSvomQ8fZ+cdYwbQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1670029798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1AU0GE+RCcx8cgEO9gmVOjkaGomeUtyAJMm7LWLtAo8=; b=IoHfENZocHkwSsB7895dMeFFZCW1t8aBV14kvj0/yHKY0L1nH9DVnVK58TzHURWhSnf2mZ gYuZDFzNC4Sr5GtaJ/va0nsALkUy2eExKjRlO2MxWz5UdV1i7Aw/BW9mtWs2egMrmFMzB1 4kF/kHZTbUCu8uv+aL3gfI/+drTksXfTVjx8IryknfFDTmKfHAXXOZqzhqP8nSGszWpwiA N6xbTx7FDYImbqzfkk+PrV5IgqG+MV4qcmokQzpsjxP+o+m2ts81zAYl082xgjAGZgkvf6 1+yNH1bnbZ6hRReuk/RZeLQtkm4lneeOdiIIID2Cel/ZeN5zmMBcDu+nJVtQvA== Date: Sat, 3 Dec 2022 01:09:37 +0000 Message-Id: <20221203010937.2332-2-antero@mailbox.org> In-Reply-To: <20221203010937.2332-1-antero@mailbox.org> References: <20221203010937.2332-1-antero@mailbox.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MBO-RS-META: r9pbwi8h79mqw8z3bdmaubzgd6765qsr X-MBO-RS-ID: abe8eacb05f5ef2b6c6 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Antero Mejr X-ACL-Warn: , Antero Mejr via Guix-patches From: Antero Mejr via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670029898; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=1AU0GE+RCcx8cgEO9gmVOjkaGomeUtyAJMm7LWLtAo8=; b=h2yrXeieKLXZ8T4HR3c7G1SZ8iGHm3wVXfcCXHaCcHL5jZOxYwUTK7cc42Z8Lnu/RCdxVb KgPwOsKrE0H2F6cnqnhj5KUaAX1GOR1xu6IxhwbR87ieSpdcEE6kRlf7bOTqqiUZxvgaZ5 izU5sKARqPzTsROiLAbbMz/bvs5hxlwPT6h4MuYowpUgGLm6lDm+Byff8EN/KMoFLQ2Xxc RN/BoIxGy0lRL5sp0Lb5F7x7M2AwTG/DWQfRGoVjJcxqtdVCWGjSPmQ/DGaHwYcyEqYgeR IYDXXpSSYoEGMnphTi7Zq6bMLmsq4sFa49xIdg+KKYmIUJyjDKYHYaX6cUHTlw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670029898; a=rsa-sha256; cv=none; b=j3gvfpPzqybf/73UcAQ1WCe25HLlUcgQ52i6oQe5VTqn7CQ8jAAPDndfBhE6g3bhtbfLHc ZCemImlnGgD/45g2uOwBEwF5m3Xj5m7G9gmOR1RKjONkvjHyFhPwswn5YM5YRCFu6auq7V XhURxOKV315iM0QyBA7aTvgEU47WBxtX85QtlJP5LXqk9J/+0btkaEKyTd/YeRMIKVptHc VRLvKQ7MbhFaO6IIPLjQcnEiP7gIU4LvpYKxVObAutcJSiE4g4cMgwdbbit5lXXevrSTvi XLIjWugoa0AbZD05+q9Yf6N/mCQTF2L+Zk/EaSON+f4vO6rFsUn6sbH8163aqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b="mNHJ6so/"; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b=IoHfENZo; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.67 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b="mNHJ6so/"; dkim=fail ("headers rsa verify failed") header.d=mailbox.org header.s=mail20150812 header.b=IoHfENZo; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 97869B88C X-Spam-Score: -2.67 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4Xc7VR9g7uXd * guix/scripts/repl.scm (%options): Add -i, --interactive flag. (guix-repl): Honor -i, --interactive flag. * doc/guix.texi (Invoking guix repl): Add documentation for -i, --interactive. --- doc/guix.texi | 12 ++++++++++++ guix/scripts/repl.scm | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index cf9e6f640d..3391c7a66c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11992,6 +11992,14 @@ lines at the top of the script: @code{!#} @end example +To make a script that launches an interactive REPL directly from the +shell, use the @code{--interactive} flag: + +@example +@code{#!/usr/bin/env -S guix repl --interactive} +@code{!#} +@end example + Without a file name argument, a Guile REPL is started, allowing for interactive use (@pxref{Using Guix Interactively}): @@ -12040,6 +12048,10 @@ Accept connections on localhost on port 37146. Accept connections on the Unix-domain socket @file{/tmp/socket}. @end table +@item --interactive +@itemx -i +Launch the interactive REPL after @var{FILE} is executed. + @item --load-path=@var{directory} @itemx -L @var{directory} Add @var{directory} to the front of the package module search path diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index 0ec62786e9..787c63d48e 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -62,6 +62,9 @@ (define %options (option '(#\q) #f #f (lambda (opt name arg result) (alist-cons 'ignore-dot-guile? #t result))) + (option '(#\i "interactive") #f #f + (lambda (opt name arg result) + (alist-cons 'interactive? #t result))) (option '(#\L "load-path") #t #f (lambda (opt name arg result) ;; XXX: Imperatively modify the search paths. @@ -84,6 +87,9 @@ (define (show-help) -q inhibit loading of ~/.guile")) (newline) (display (G_ " + -i, --interactive launch REPL after evaluating FILE")) + (newline) + (display (G_ " -L, --load-path=DIR prepend DIR to the package module search path")) (newline) (display (G_ " @@ -196,7 +202,7 @@ (define script ;; file in %LOAD-PATH. Thus, pass (getcwd) instead of ".". (load-in-vicinity (getcwd) (car script))))) - (when (null? script) + (when (or (null? script) (assoc-ref opts 'interactive?)) ;; Start REPL (let ((type (assoc-ref opts 'type))) (call-with-connection (assoc-ref opts 'listen) -- 2.38.1