branch: elpa/hyperdrive
commit fe92cbbc2bfc217c102d79cdd43ff9314e2c6eb8
Author: Joseph Turner <jos...@ushin.org>
Commit: Joseph Turner <jos...@ushin.org>

    Add: (hyperdrive-mark-as-safe) Command to mark hyperdrive as safe
---
 hyperdrive.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/hyperdrive.el b/hyperdrive.el
index 6cab5ad8aa..72a7de1fd8 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -151,6 +151,25 @@ hyperdrive, the new hyperdrive's petname will be set to 
SEED."
       (h/persist hyperdrive)
       (h/open (h/url-entry url)))))
 
+;;;###autoload
+(defun hyperdrive-mark-as-safe (hyperdrive safep)
+  "Mark HYPERDRIVE as safe according to SAFEP.
+Interactively, prompt to toggle safety.  With universal prefix
+argument \\[universal-argument], toggle without prompting."
+  (interactive
+   (pcase-let* ((hyperdrive (h/complete-hyperdrive :force-prompt t))
+                ((cl-struct hyperdrive (etc (map safep))) hyperdrive)
+                (mark-safe-p
+                 (yes-or-no-p
+                  (format "Mark `%s' as safe (currently: %s)?"
+                          (h//format-hyperdrive hyperdrive)
+                          (if safep
+                              (propertize "safe" 'face 'success)
+                            (propertize "not safe" 'face 'error))))))
+     (list hyperdrive mark-safe-p)))
+  (setf (map-elt (h/etc hyperdrive) 'safep) safep)
+  (h/persist hyperdrive))
+
 ;;;###autoload
 (defun hyperdrive-purge (hyperdrive)
   "Purge all data corresponding to HYPERDRIVE."

Reply via email to