unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: jgart <jgart@dismail.de>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix Devel <guix-devel@gnu.org>, zimoun <zimon.toutoune@gmail.com>
Subject: Re: repl macro (metacommand?) for guix CLI (sub)commands
Date: Mon, 4 Jul 2022 13:21:59 -0500	[thread overview]
Message-ID: <20220704132159.GC3017@gac> (raw)
In-Reply-To: <87mtdpau7y.fsf@gnu.org>

On Mon, 04 Jul 2022 15:22:09 +0200 Ludovic Courtès <ludo@gnu.org> wrote:
> In addition to what zimoun wrote, see this discussion about providing
> REPL metacommands to lower or build things:

Simoun, thanks for the repl session demo. I hadn't tried running the
guix scripts modules at the repl yet. Ludo, thanks for the metacommand
discussion link. It's much appreciated!

In exploring at the repl a bit now I realized that running

`(guix-package "--help")` or `(guix-package "--version")` causes the
repl to exit.

This is because each of those "CLI calls" end up running `(exit 0)`
at the end in some form or another.

Would it be desireable to write some extra code to have the `guix-*`
"CLI functions" not call `(exit 0)` if in a repl and call it if using
from the command line? I imagine that this is only desireable if using
the command line? That way I won't be thrown out of the repl session by
accident and the experience would be more like the CLI experience.

I'm thinking something like a `maybe-exit` and
`show-version-and-maybe-exit` function instead of `(exit 0)` and
`show-version-and-exit` as currently used, respectively.

I'm not sure at the moment on how to detect if I am in a repl when
calling those functions or if I am calling them from the command line.

What do you think?

--
jgart


  reply	other threads:[~2022-07-04 18:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-03 18:11 repl macro (metacommand?) for guix CLI (sub)commands jgart
2022-07-04  8:29 ` zimoun
2022-07-04 13:22 ` Ludovic Courtès
2022-07-04 18:21   ` jgart [this message]
2022-07-04 20:28     ` Tobias Geerinckx-Rice
2022-07-04 22:47       ` zimoun
2022-07-05 22:27         ` jgart
2022-07-06  6:44           ` zimoun
2022-07-06 12:13             ` bokr
2022-07-06 12:58               ` zimoun
2022-07-16 19:08                 ` Bengt Richter
2022-07-07  7:31     ` Ludovic Courtès
2022-07-07  7:58       ` bokr

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220704132159.GC3017@gac \
    --to=jgart@dismail.de \
    --cc=guix-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).