all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "\( via Guix-patches" via <guix-patches@gnu.org>
To: 57031@debbugs.gnu.org
Cc: "\(" <paren@disroot.org>
Subject: [bug#57031] [PATCH v3 1/2] ui: Make one-time hint API public.
Date: Thu, 27 Oct 2022 20:42:42 +0100	[thread overview]
Message-ID: <20221027194243.15612-1-paren@disroot.org> (raw)
In-Reply-To: <20220807111421.14771-1-paren@disroot.org>

* guix/scripts/shell.scm (hint-directory, hint-file, record-hint,
  hint-given?): Move these...
* guix/ui.scm (hint-directory, hint-file, record-hint, hint-given?):
  ...here.
---
 guix/scripts/shell.scm | 23 -----------------------
 guix/ui.scm            | 29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm
index a2836629ad..c66ff4e5c4 100644
--- a/guix/scripts/shell.scm
+++ b/guix/scripts/shell.scm
@@ -505,29 +505,6 @@ (define (validated-spec spec)
       (exp
        (pretty-print exp port)))))
 
-\f
-;;;
-;;; One-time hints.
-;;;
-
-(define (hint-directory)
-  "Return the directory name where previously given hints are recorded."
-  (string-append (cache-directory #:ensure? #f) "/hints"))
-
-(define (hint-file hint)
-  "Return the name of the file that marks HINT as already printed."
-  (string-append (hint-directory) "/" (symbol->string hint)))
-
-(define (record-hint hint)
-  "Mark HINT as already given."
-  (let ((file (hint-file hint)))
-    (mkdir-p (dirname file))
-    (close-fdes (open-fdes file (logior O_CREAT O_WRONLY)))))
-
-(define (hint-given? hint)
-  "Return true if HINT was already given."
-  (file-exists? (hint-file hint)))
-
 \f
 (define-command (guix-shell . args)
   (category development)
diff --git a/guix/ui.scm b/guix/ui.scm
index dad2b853ac..3512c761d2 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2018 Steve Sprang <scs@stevesprang.com>
 ;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
 ;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2022 ( <paren@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -137,6 +138,11 @@ (define-module (guix ui)
             switch-to-generation*
             delete-generation*
 
+            hint-directory
+            hint-file
+            record-hint
+            hint-given?
+
             %default-message-language
             current-message-language
 
@@ -2057,6 +2063,29 @@ (define* (package-specification->name+version+output spec
                  (package-name->name+version name)))
     (values name version sub-drv)))
 
+\f
+;;;
+;;; One-time hints.
+;;;
+
+(define (hint-directory)
+  "Return the directory name where previously given hints are recorded."
+  (string-append (cache-directory #:ensure? #f) "/hints"))
+
+(define (hint-file hint)
+  "Return the name of the file that marks HINT as already printed."
+  (string-append (hint-directory) "/" (symbol->string hint)))
+
+(define (record-hint hint)
+  "Mark HINT as already given."
+  (let ((file (hint-file hint)))
+    (mkdir-p (dirname file))
+    (close-fdes (open-fdes file (logior O_CREAT O_WRONLY)))))
+
+(define (hint-given? hint)
+  "Return true if HINT was already given."
+  (file-exists? (hint-file hint)))
+
 \f
 ;;;
 ;;; Command-line option processing.

base-commit: f928abac369f699f425ddee925d0d0c2dc0a635d
-- 
2.38.0





  parent reply	other threads:[~2022-10-27 19:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 11:14 [bug#57031] [PATCH] scripts: Show a hint the first time some commands are run as root ( via Guix-patches via
2022-08-07 11:19 ` [bug#57031] [PATCH v2] " ( via Guix-patches via
2022-08-07 11:22   ` ( via Guix-patches via
2022-09-05 21:11   ` [bug#57031] [PATCH] " Ludovic Courtès
2022-09-11 13:05     ` ( via Guix-patches via
2022-09-11 19:59 ` [bug#57031] [PATCH v2 1/2] ui: Make one-time hint API public ( via Guix-patches via
2022-09-11 19:59   ` [bug#57031] [PATCH v2 2/2] scripts: Warn the first time pull or package is run as root ( via Guix-patches via
2022-10-26 18:14     ` zimoun
2022-10-27  5:52       ` ( via Guix-patches via
2022-10-27  8:23         ` zimoun
2022-10-28 14:33           ` ( via Guix-patches via
2022-10-27 19:42 ` ( via Guix-patches via [this message]
2022-10-27 19:42   ` [bug#57031] [PATCH v3 " ( via Guix-patches via

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=20221027194243.15612-1-paren@disroot.org \
    --to=guix-patches@gnu.org \
    --cc=57031@debbugs.gnu.org \
    --cc=paren@disroot.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 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.