fix directory and lock vault
This commit is contained in:
21
rbw.el
21
rbw.el
@@ -1,6 +1,6 @@
|
||||
(defun rbw-get-password ()
|
||||
(interactive)
|
||||
(kill-new (rbw/list-all)))
|
||||
(if (rbw/unlocked) (kill-new (rbw/list-all)) (message "locked vault")))
|
||||
|
||||
(defun rbw-add ()
|
||||
(interactive)
|
||||
@@ -23,14 +23,17 @@
|
||||
(interactive)
|
||||
(let* ((output (rbw/list-all "--field user"))
|
||||
(output (string-trim-left output "Username: ")))
|
||||
(kill-new output)))
|
||||
(if (rbw/unlocked) (kill-new output) (message "locked vault"))))
|
||||
|
||||
(defun rbw-generate ()
|
||||
(interactive)
|
||||
(let* ((length (read-number "password length: ")))
|
||||
(kill-new (rbw/generate length))))
|
||||
|
||||
(defun rbw/sync () (shell-command "rbw sync"))
|
||||
(defun rbw-sync ()
|
||||
(interactive)
|
||||
(let* ((default-directory "/home/luis/"))
|
||||
(shell-command "rbw sync")))
|
||||
|
||||
(defun rbw/list-all (&optional options entries selected)
|
||||
(let* ((entries (if entries entries (rbw/list)))
|
||||
@@ -44,21 +47,25 @@
|
||||
(rbw/list-all options (rbw/extract-multiple output selected) selected))))
|
||||
|
||||
(defun rbw/generate (length &optional name user)
|
||||
(let* ((length (number-to-string length))
|
||||
(let* ((default-directory "/home/luis/")
|
||||
(length (number-to-string length))
|
||||
(command (concat "rbw generate " length " " name " " user)))
|
||||
(shell-command-to-string command)))
|
||||
|
||||
(defun rbw/unlocked ()
|
||||
(if (string-empty-p (shell-command-to-string "rbw unlocked")) t nil))
|
||||
(let* ((default-directory "/home/luis/"))
|
||||
(if (string-empty-p (shell-command-to-string "rbw unlocked")) t nil)))
|
||||
|
||||
(defun rbw/list ()
|
||||
(let* ((output (shell-command-to-string "rbw list"))
|
||||
(let* ((default-directory "/home/luis/")
|
||||
(output (shell-command-to-string "rbw list"))
|
||||
(output (string-trim output))
|
||||
(entries (split-string output "\n")))
|
||||
entries))
|
||||
|
||||
(defun rbw/get (entry &optional options)
|
||||
(let* ((command (concat "rbw get " options " " entry " ; echo $?"))
|
||||
(let* ((default-directory "/home/luis/")
|
||||
(command (concat "rbw get " options " " entry " ; echo $?"))
|
||||
(output (shell-command-to-string command))
|
||||
(output (string-trim output))
|
||||
(output (split-string output "\n"))
|
||||
|
||||
Reference in New Issue
Block a user