From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: guix-devel@gnu.org
Subject: Re: User-Friendlyness of Guix and non-scaryness, printing messages
Date: Tue, 30 May 2017 17:11:36 +0200 [thread overview]
Message-ID: <87efv64bx3.fsf@gnu.org> (raw)
In-Reply-To: <20170528225823.6db84e61@scratchpost.org> (Danny Milosavljevic's message of "Sun, 28 May 2017 22:58:23 +0200")
Hi Danny,
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> And also the spinner integrated:
>
> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
> index f050fad97..d9ac61122 100644
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -46,6 +46,7 @@
> #:use-module (srfi srfi-34)
> #:use-module (srfi srfi-35)
> #:use-module (srfi srfi-37)
> + #:use-module (rnrs io ports)
> #:use-module (gnu packages)
> #:autoload (gnu packages base) (canonical-package)
> #:autoload (gnu packages guile) (guile-2.0)
> @@ -187,6 +188,27 @@ denote ranges as interpreted by 'matching-generations'."
> (else
> (leave (G_ "invalid syntax: ~a~%") pattern)))))
>
> +(define previous-output-port (current-error-port))
> +
> +(define spinner-port
> + (let ((index 0)
> + (spinner-chars "|\\-/"))
> + (define (spin)
> + (set! index (+ index 1))
> + (if (>= index (string-length spinner-chars))
> + (set! index 0))
> + (display (array-ref spinner-chars index) previous-output-port)
> + (display #\backspace previous-output-port)
> + (flush-output-port previous-output-port))
> + (make-soft-port
> + (vector
> + (lambda (c) (if (char=? c #\newline) (spin))) ; putc
> + (lambda (s) (if (string-contains s "\n") (spin))) ; puts
> + (lambda () #t) ; flush
> + (lambda () #f) ; getc
> + (lambda () #t)) ; close
> + "w")))
Nice hack! I don’t think we should incorporate it just right now; I
would prefer something that writes “building foo” or “downloading bar”
in addition to the spinner, like ‘wip-ui’ tries to do.
WDYT?
Ludo’.
next prev parent reply other threads:[~2017-05-30 15:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87bbe3e5.AEAAKL2r-KIAAAAAAAAAAAOtUOAAAAACwQwAAAAAAAW9WABZGcQo@mailjet.com>
[not found] ` <87y3tw4kw3.fsf@gnu.org>
[not found] ` <fcac084e.AEEAKxWCyNIAAAAAAAAAAAOzWv8AAAACwQwAAAAAAAW9WABZH1iD@mailjet.com>
[not found] ` <87r2zfx0xt.fsf@gnu.org>
[not found] ` <427678e8.AEUAKjfDcSgAAAAAAAAAAAPB0agAAAACwQwAAAAAAAW9WABZKceD@mailjet.com>
2017-05-28 18:44 ` User-Friendlyness of Guix and non-scaryness, printing messages Danny Milosavljevic
2017-05-28 19:01 ` Danny Milosavljevic
2017-05-28 20:35 ` Danny Milosavljevic
2017-05-28 20:58 ` Danny Milosavljevic
2017-05-30 15:11 ` Ludovic Courtès [this message]
2017-05-28 19:20 ` Leo Famulari
2017-05-28 19:40 ` Danny Milosavljevic
2017-05-28 19:47 ` Leo Famulari
2017-05-28 21:12 ` Ludovic Courtès
2017-05-31 22:26 ` Danny Milosavljevic
2017-06-01 21:41 ` Ludovic Courtès
2017-05-30 8:24 ` Ricardo Wurmus
2017-06-16 11:42 ` Danny Milosavljevic
2017-06-17 20:16 ` Ludovic Courtès
2017-05-30 1:47 ` "guix system" summary output? Danny Milosavljevic
2017-05-30 11:05 ` Danny Milosavljevic
2017-05-30 15:47 ` Ludovic Courtès
2017-05-30 8:17 ` User-Friendlyness of Guix and non-scaryness, printing messages Roel Janssen
2017-05-30 13:56 ` Arun Isaac
2017-05-30 14:32 ` Christopher Allan Webber
2017-05-30 15:58 ` Arun Isaac
2017-05-30 15:13 ` Ludovic Courtès
2017-05-28 19:30 ` ng0
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=87efv64bx3.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=dannym@scratchpost.org \
--cc=guix-devel@gnu.org \
/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).