aboutsummaryrefslogtreecommitdiff
path: root/pw
diff options
context:
space:
mode:
authorAnirudh Oppiliappan <x@icyphox.sh>2019-11-17 15:19:41 +0530
committerAnirudh Oppiliappan <x@icyphox.sh>2019-11-17 15:19:41 +0530
commit5c459f413cfe812ffeeeeebee37c819a0163a659 (patch)
tree795e997e07924dfcc0e3217f1df1f11a5d57037c /pw
parent0a5b7244b36afce7b95e77d1ce8acda600513a9a (diff)
downloadpw-5c459f413cfe812ffeeeeebee37c819a0163a659.tar.gz
Add new `-l` flag to list out pws
Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Diffstat (limited to 'pw')
-rwxr-xr-xpw12
1 files changed, 10 insertions, 2 deletions
diff --git a/pw b/pw
index 2e5f36a..4e0e29e 100755
--- a/pw
+++ b/pw
@@ -33,6 +33,12 @@ add() {
33 fi 33 fi
34} 34}
35 35
36list() {
37 for f in "$PW_DIR"/*.gpg; do
38 printf '%s\n' "$(basename ${f%.gpg})"
39 done
40}
41
36del() { 42del() {
37 checkf "$PW_DIR/$1.gpg" 43 checkf "$PW_DIR/$1.gpg"
38 read -rn 1 -p "pw: are you sure you want to delete $1? [y/n]: " 44 read -rn 1 -p "pw: are you sure you want to delete $1? [y/n]: "
@@ -60,7 +66,7 @@ usage() {
60 usage=" 66 usage="
61pw - mnml password manager 67pw - mnml password manager
62 68
63usage: pw [options] 69usage: pw [options] [NAME]
64All options except -i and -h require a NAME argument. 70All options except -i and -h require a NAME argument.
65 71
66options: 72options:
@@ -68,6 +74,7 @@ options:
68 -a Add a password. 74 -a Add a password.
69 -g Generate a password. 75 -g Generate a password.
70 -s Print password to STDOUT. 76 -s Print password to STDOUT.
77 -l List out all passwords.
71 -c Copy existing password to clipboard. 78 -c Copy existing password to clipboard.
72 -d Delete password. 79 -d Delete password.
73 -h Display this help message and exit. 80 -h Display this help message and exit.
@@ -95,10 +102,11 @@ main() {
95 usage 102 usage
96 } 103 }
97 104
98 while getopts "ia:g:s:c:d:h" options 105 while getopts "ila:g:s:c:d:h" options
99 do 106 do
100 case "$options" in 107 case "$options" in
101 i) init ;; 108 i) init ;;
109 l) list ;;
102 g) add "$OPTARG" ;; 110 g) add "$OPTARG" ;;
103 a) 111 a)
104 read -rsp "enter password: " pass 112 read -rsp "enter password: " pass