[PATCH] ui: spinner-port: New variable. Export it.

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Ludovic Courtès
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 8 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20170703185520.4475-1-dannym@scratchpost.org
* guix/ui.scm (spinner-port): New variable. Export it.
---
guix/ui.scm | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

Toggle diff (41 lines)
diff --git a/guix/ui.scm b/guix/ui.scm
index 4bad00e8c..0930ed2b7 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -102,7 +102,8 @@
guix-warning-port
warning
info
- guix-main))
+ guix-main
+ spinner-port))
;;; Commentary:
;;;
@@ -110,6 +111,26 @@
;;;
;;; Code:
+(define spinner-port
+ (let ((index 0)
+ (spinner-chars "|\\-/"))
+ (define previous-output-port (current-error-port))
+ (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)
+ (force-output 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) ; flusher
+ (lambda () #f) ; getc
+ (lambda () #t)) ; close
+ "w")))
+
(define %gettext-domain
;; Text domain for strings used in the tools.
"guix")
Ludovic Courtès wrote 8 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 27566@debbugs.gnu.org)
87r2x3a8sl.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (2 lines)
> * guix/ui.scm (spinner-port): New variable. Export it.

I’d like to see where we’d use it before committing it. What would be
the first use?

Thanks,
Ludo’.
Ricardo Wurmus wrote 7 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87vajc2hez.fsf@elephly.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (7 lines)
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>
>> * guix/ui.scm (spinner-port): New variable. Export it.
>
> I’d like to see where we’d use it before committing it. What would be
> the first use?

Ping :)

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
Danny Milosavljevic wrote 6 years ago
(no subject)
(address . control@debbugs.gnu.org)
20190122153655.7302b064@scratchpost.org
close 27566
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlxHKocACgkQ5xo1VCww
uqVJFwgAmRoeCGKpWjLXY0T1IxFxgai8Mreu+2j3RLrZvefocB7dsjQWcvwcYUfP
EX27H72qTSOncAKYTbfXou9p1kTaqH7gNfTRb+osUBfFWOjHvtZsI0K8smfQPVG9
4k3En8vHJX6/Uvcs4lLhK339RbFLD94DD0MR0xTBEV5NYFdGAWzpyUNAlrujaYM4
Ta+So1LHz2cvzHeviuv5DpxuFC7xQxjhiNQeVt9hlThRy2YXpnKRhbK6idGK6INj
v4cjuX99osWIC4quI1jPpuSLhPtra0uluSIJDvOz+JProlFf6oqZHfvn0cESbeXT
fV+zLGhwih/36BxxGjTlYQRxBhksqw==
=zru1
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 27566@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 27566
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help