commit b760f374c48ca1f98ab289e202af5306da79dc70
parent 7c1b7e5fea36e656a95267fe3e256573504f3ada
Author: Tino Calancha <tino.calancha@gmail.com>
Date: Tue, 27 Aug 2019 11:20:02 +0200
emacs: Improve password-store-insert message on success/failure
Before, the following message was shown:
"Enter contents of ENTRY and press Ctrl+D when finished:\n\n"
Since the command is not interactive, it is better to show users
specific messages on success/failure.
* contrib/emacs/password-store.el (password-store-insert):
Improve message shown on success/failure.
Diffstat:
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/contrib/emacs/CHANGELOG.md b/contrib/emacs/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 2.0.5
+
+Improve password-store-insert message on success/failure
+
# 2.0.4
* Re add password-store-timeout function to preserve backward
diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
@@ -4,7 +4,7 @@
;; Author: Svend Sorensen <svend@svends.net>
;; Maintainer: Tino Calancha <tino.calancha@gmail.com>
-;; Version: 2.0.4
+;; Version: 2.0.5
;; URL: https://www.passwordstore.org/
;; Package-Requires: ((emacs "25") (f "0.11.0") (s "1.9.0") (with-editor "2.5.11"))
;; Keywords: tools pass password password-store
@@ -266,11 +266,15 @@ Separate multiple IDs with spaces."
"Insert a new ENTRY containing PASSWORD."
(interactive (list (read-string "Password entry: ")
(read-passwd "Password: " t)))
- (message "%s" (shell-command-to-string
- (format "echo %s | %s insert -m -f %s"
- (shell-quote-argument password)
- password-store-executable
- (shell-quote-argument entry)))))
+ (let* ((command (format "echo %s | %s insert -m -f %s"
+ (shell-quote-argument password)
+ password-store-executable
+ (shell-quote-argument entry)))
+ (ret (process-file-shell-command command)))
+ (if (zerop ret)
+ (message "Successfully inserted entry for %s" entry)
+ (message "Cannot insert entry for %s" entry))
+ nil))
;;;###autoload
(defun password-store-generate (entry &optional password-length)