all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Tobias Geerinckx-Rice <me@tobias.gr>
Cc: Jonas Freimuth <jonas.freimuth@posteo.de>,
	Guix-devel <guix-devel@gnu.org>
Subject: Re: bug#58417: Installer script no longer works with `yes` utility
Date: Tue, 11 Oct 2022 15:29:53 -0400	[thread overview]
Message-ID: <87h70acg5q.fsf@gmail.com> (raw)
In-Reply-To: <8735buwbjl.fsf@nckx> (Tobias Geerinckx-Rice's message of "Tue, 11 Oct 2022 18:26:35 +0200")

Hi,

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> [Shunted to guix-devel@]
>
> Jonas Freimuth 写道:
>> bash -c 'yes | bash guix-install.sh'
>
> While this happens to work (again) now, that doesn't mean it always
> will or should be considered supported.
>
> We should reserve the right to ask future questions to which the
> safe/sane/common answer is ‘no’, without phrasing it awkwardly just to
> make an unthinking stream of ‘y’s happy.
>
>  $ guix-install.sh
>  …
>  Would you like to NOT enable the Cool Experimental Feature?
>  (DANGER) [Y/n]
>
> Conversely, I'd like to add a comment that does commit to always
> keeping ‘yes '' | bash guix-install.sh’ working, assuming there was no
> other input or detected issues.  Also nice for humans in a hurry.
>
> Does that seem unreasonable to anyone?

To the contrary, that seems pretty reasonable.  You may be interested in
this version of a biased prompt, gracefully shared by Earnestly from
#bash:

--8<---------------cut here---------------start------------->8---
confirm() {
    local -l reply
    local prompt bias=$1
    shift

    case $bias in
        yes) prompt=Y/n ;;
        no)  prompt=y/N
    esac

    # shellcheck disable=SC2059
    printf -- "\033[1m* $1 [$prompt]\033[0m " "${@:2}"
    read -r reply

    case $bias in
        yes) [[ $reply = y || ! $reply ]] ;;
        no)  [[ $reply = y ]]
    esac
}
--8<---------------cut here---------------end--------------->8---

The first arguments is the default argument (yes or no).  The rest works
the same (but they used printf to format things).  We can adapt our
version with that.

If you make the change you'll want to write a news so that 'yes' users
can transition to "yes ''".

-- 
Thanks,
Maxim


  parent reply	other threads:[~2022-10-11 19:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 15:33 bug#58417: Installer script no longer works with `yes` utility Jonas Freimuth
2022-10-11 16:04 ` Maxim Cournoyer
2022-10-11 16:26 ` Tobias Geerinckx-Rice
2022-10-11 18:38   ` zimoun
2022-10-17  1:22     ` Maxim Cournoyer
2022-10-17  7:55       ` zimoun
2022-10-17 21:22         ` Maxim Cournoyer
2022-10-17 21:58           ` zimoun
2022-10-11 19:29   ` Maxim Cournoyer [this message]
2022-10-11 19:32   ` Maxim Cournoyer

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

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

  git send-email \
    --in-reply-to=87h70acg5q.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=jonas.freimuth@posteo.de \
    --cc=me@tobias.gr \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.