unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: bokr@bokr.com
To: zimoun <zimon.toutoune@gmail.com>
Cc: jgart <jgart@dismail.de>, "Tobias Geerinckx-Rice" <me@tobias.gr>,
	guix-devel@gnu.org, "Ludovic Courtès" <ludo@gnu.org>
Subject: Re: repl macro (metacommand?) for guix CLI (sub)commands
Date: Wed, 6 Jul 2022 14:13:38 +0200	[thread overview]
Message-ID: <20220706121338.GA16119@LionPure> (raw)
In-Reply-To: <87o7y2zqnj.fsf@gmail.com>

Hi,

On +2022-07-06 08:44:32 +0200, zimoun wrote:
> Hi,
> 
> On mar., 05 juil. 2022 at 17:27, jgart <jgart@dismail.de> wrote:
> 
> > That's a good question! Maybe we should make a feature table and analyze
> > what we currently have exposed to decide what we might want in the near
> > future that we don't currently have.
> 
> What is already exposed:
> 
> --8<---------------cut here---------------start------------->8---
> $ guix repl
> GNU Guile 3.0.8
> Copyright (C) 1995-2021 Free Software Foundation, Inc.
> 
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
> 
> Enter `,help' for help.
> scheme@(guix-user)> ,help guix
> Guix Commands [abbrev]:
> 
>  ,run-in-store EXP                 - Run EXP through the store monad.
>  ,enter-store-monad                - Enter a REPL for values in the store monad.
> 
> scheme@(guix-user)>
> --8<---------------cut here---------------end--------------->8---
> 
> And patch#56114 [1] introduce in addition:
> 
>  ,verbosity LEVEL                  - Change build verbosity to LEVEL.
>  ,lower OBJECT                     - Lower OBJECT into a derivation and return it.
>  ,build OBJECT                     - Lower OBJECT and build it, returning its output file name(s).
> 
> 
> 1: <https://issues.guix.gnu.org/56114>
> 
> 
> >> Is it possible to detect if an interactive call?  I was thinking to add
> >> a global parameter in ’(guix scripts repl) and then this new
> >> ’maybe-exit’ could check it; but I guess Guile provides a better
> >> mechanism for checking interactiveness.
> >
> > Do you know if guile provides a way of checking that? Should we ask on
> > the guile mailing list or should we read more code first to see what's
> > currently provided?
> 
> I do not know about a Guile feature allowing to check the
> interactiveness.  It seems worth to ask on Guile mailing list because,
> if such feature exists then, I have missed from the Guile manual.
> 
> 
> Cheers,
> simon
> 

I think (IANA bash expert) PS1 should be a pretty good indicator,
unless something funny is going on :)

(Note the difference between executing and sourcing):

(IDK if other shells use PS1 so it would work in such environments)
I looked in man ps to see if possibly ps -o <something> could make
an easy check (seems like there ought to be, but I am out of time
after almost an hour of experimenting :/ )

--8<---------------cut here---------------start------------->8---
[13:23 ~/bs]$ guile --no-auto-compile -c '(display (getenv "PS1"))(newline)'
[\A \w]\$ 
[13:24 ~/bs]$ ./guile-non-int-call 
PS1_val='#f'
#f
[13:24 ~/bs]$ source ./guile-non-int-call 
PS1_val='[\A \w]\$ '
[\A \w]\$ 
[13:24 ~/bs]$ cat -nA ./guile-non-int-call
     1  #!/usr/bin/bash$
     2  PS1_val="$(guile --no-auto-compile -c '(display (getenv "PS1"))(newline)')"$
     3  echo "PS1_val='$PS1_val'"$
     4  guile --no-auto-compile -c '(display (getenv "PS1"))(newline)'$
[13:25 ~/bs]$ 
--8<---------------cut here---------------end--------------->8---

HTH
--
Regards
Bengt Richter


  reply	other threads:[~2022-07-06 12:14 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
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 [this message]
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=20220706121338.GA16119@LionPure \
    --to=bokr@bokr.com \
    --cc=guix-devel@gnu.org \
    --cc=jgart@dismail.de \
    --cc=ludo@gnu.org \
    --cc=me@tobias.gr \
    --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).