Refactor account printing procedure - pee - Pee a password manager;Pee - becaus… | |
git clone git://vernunftzentrum.de/pee.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 9ef725dc3d118b83b56b97690fc966f2df79add1 | |
parent b1796046357c43e891ea45b50e9c4998d9a45060 | |
Author: Christian Kellermann <[email protected]> | |
Date: Wed, 20 Apr 2016 15:22:21 +0200 | |
Refactor account printing procedure | |
Diffstat: | |
pee.scm | 18 ++++++++++-------- | |
1 file changed, 10 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/pee.scm b/pee.scm | |
@@ -194,6 +194,12 @@ | |
db | |
equal?))) | |
+(define (print-entry entry #!key show-password) | |
+ (match-let (((user pass comment last-modified) entry)) | |
+ (printf "User: ~a\tPass: ~a\tComment: ~a\tLast changed: ~a~%" | |
+ user (if show-password pass "***") comment | |
+ (time->string (seconds->local-time last-modified) "%Y-%m-… | |
+ | |
(define (check-access f) | |
(and (file-exists? f) | |
(file-read-access? f) | |
@@ -299,10 +305,8 @@ | |
(define (do-delete db-name db p account) | |
(cond ((alist-ref account db equal?) => | |
(lambda (e) | |
- (match-let (((user _ comment last-modified) e)) | |
- (printf "Account: ~a\tUser: ~a\tComment: ~a\tLast changed: ~… | |
- account user comment | |
- (time->string (seconds->local-time last-modified) "%… | |
+ (printf "Account: ~a" account) | |
+ (print-entry e) | |
(cond ((ask-yes-or-no "Really delete account?") | |
(encrypt-file db-name (alist-delete account db equal?) p) | |
(print "Entry '" account "' deleted.")) | |
@@ -324,10 +328,8 @@ | |
(exit 1)) | |
(for-each | |
(lambda (account-name) | |
- (match-let (((user _ comment last-modified) (alist-ref account-name db … | |
- (printf "Account: ~a\tUser: ~a\tComment: ~a\tLast changed: ~… | |
- account-name user comment | |
- (time->string (seconds->local-time last-modified) "%… | |
+ (printf "Account: ~a\t" account-name) | |
+ (print-entry (alist-ref account-name db equal?))) | |
accounts))) | |
(define (do-password db e) |