From patchwork Fri Dec 2 02:56:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antero Mejr X-Patchwork-Id: 44998 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5AEAD27BBE9; Fri, 2 Dec 2022 02:58:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3BB9B27BBEB for ; Fri, 2 Dec 2022 02:58:35 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0wFZ-0006SK-Id; Thu, 01 Dec 2022 21:58:06 -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 1p0wFX-0006Rl-44 for guix-patches@gnu.org; Thu, 01 Dec 2022 21:58:03 -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 1p0wFW-0007Ty-2b; Thu, 01 Dec 2022 21:58:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0wFV-00055J-Q0; Thu, 01 Dec 2022 21:58:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59754] [PATCH] scripts: repl: Add --interactive and --list-types flags. Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 02 Dec 2022 02:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59754 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59754@debbugs.gnu.org Cc: Antero Mejr , ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166994984419531 (code B ref -1); Fri, 02 Dec 2022 02:58:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Dec 2022 02:57:24 +0000 Received: from localhost ([127.0.0.1]:43498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0wEu-00054x-Cw for submit@debbugs.gnu.org; Thu, 01 Dec 2022 21:57:24 -0500 Received: from lists.gnu.org ([209.51.188.17]:35902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0wEt-00054p-By for submit@debbugs.gnu.org; Thu, 01 Dec 2022 21:57:23 -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 1p0wEr-0006GL-Tk for guix-patches@gnu.org; Thu, 01 Dec 2022 21:57:22 -0500 Received: from mout-p-102.mailbox.org ([80.241.56.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1p0wEn-0007Op-Ml for guix-patches@gnu.org; Thu, 01 Dec 2022 21:57:21 -0500 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (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-102.mailbox.org (Postfix) with ESMTPS id 4NNczk17sPz9sRl for ; Fri, 2 Dec 2022 03:57:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1669949826; 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; bh=oCc+/PKkxECUuG/CILxI0HnhpIswWm91BeVmwAWoAk0=; b=s+UBXRghSpjClIj/amTFqLjTCsMw4SY/iWJBRApsIqhOhStdrfpAJr7iXKmj/JwG1V2F/i +KKzybxa5oqnrP84pDj4q1Op26chIgUpMf8p4996zyjMbdvsY06pm01FbgW89RwIkFST3S Ij855VKGnRqjDTqc4NHLzciVhE5ry5umz3xYql/Ib1nvze7sTIb76KP8/oZeQxb0T95s47 K2DO/d4eb6DuOmQKVF+ug/YAan/Yn4iwIWUsT/Fobi9Msqpj3JBtbnqzdJQc0bnb6rVFXR 6o8ruBGunCdX//4hdjmMwrYjB0bEs7sd948NmrtePNIJXaOmAfM2GCgCvdQHuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1669949822; 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; bh=oCc+/PKkxECUuG/CILxI0HnhpIswWm91BeVmwAWoAk0=; b=F9rXdkQrtC6tkfDOkQTn1n7WchoLFKfhtEBy/6O1WptEZSD4lxd9nm4k/6oln1cxnC1lw1 QYZqSj6q7LgqTDCeNYMhyMw1DMlPaMM2W9MCkduNc1EMAh2czkzN4DPfV4LqQsFd9HGei/ AkAFhct9qMN9I994DgstsGhUeRqor5Spo7c3ZpuDLlrbLLTQEWY+fh5qeMIVGnZ8k3W63L PRC388B5xszzEC0YvqybxrvAEsulMjqiSeC7wTu99adw9TNA1GhM3xe4FBgnuDvXsxWkqF hhiT/cj5VB1z3GmfUvfnuzFNbqabW+rZix1c15SY13n29ou+eda6unApWeufIw== Date: Fri, 2 Dec 2022 02:56:41 +0000 Message-Id: <20221202025641.9318-1-antero@mailbox.org> MIME-Version: 1.0 X-MBO-RS-ID: 3cf16a21c9518df9c62 X-MBO-RS-META: jzboa7j6j9jfjpg86fcpfq69a1i99h7q Received-SPF: pass client-ip=80.241.56.152; envelope-from=antero@mailbox.org; helo=mout-p-102.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 X-Patchwork-Original-From: Antero Mejr via Guix-patches via From: Antero Mejr Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/repl.scm (guix-repl): Honor -i, --interactive flag. (%options): Add -i/--interactive and --l/--list-types. --- guix/scripts/repl.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index 50d18c7760..eac3d7264e 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -52,12 +52,19 @@ (define %options (option '(#\t "type") #t #f (lambda (opt name arg result) (alist-cons 'type (string->symbol arg) result))) + (option '(#\l "list-types") #f #f + (lambda (opt name arg result) + (display (string-join '("guile" "machine") "\n" 'suffix)) + (exit 0))) (option '("listen") #t #f (lambda (opt name arg result) (alist-cons 'listen arg result))) (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. @@ -78,9 +85,15 @@ (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_ " + -l, --list-types display REPL types and exit")) + (newline) + (display (G_ " -h, --help display this help and exit")) (display (G_ " -V, --version display version information and exit")) @@ -190,7 +203,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)