diff options
author | Anirudh Oppiliappan <x@icyphox.sh> | 2019-11-17 15:19:41 +0530 |
---|---|---|
committer | Anirudh Oppiliappan <x@icyphox.sh> | 2019-11-17 15:19:41 +0530 |
commit | 5c459f413cfe812ffeeeeebee37c819a0163a659 (patch) | |
tree | 795e997e07924dfcc0e3217f1df1f11a5d57037c /pw | |
parent | 0a5b7244b36afce7b95e77d1ce8acda600513a9a (diff) | |
download | pw-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-x | pw | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -33,6 +33,12 @@ add() { | |||
33 | fi | 33 | fi |
34 | } | 34 | } |
35 | 35 | ||
36 | list() { | ||
37 | for f in "$PW_DIR"/*.gpg; do | ||
38 | printf '%s\n' "$(basename ${f%.gpg})" | ||
39 | done | ||
40 | } | ||
41 | |||
36 | del() { | 42 | del() { |
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=" |
61 | pw - mnml password manager | 67 | pw - mnml password manager |
62 | 68 | ||
63 | usage: pw [options] | 69 | usage: pw [options] [NAME] |
64 | All options except -i and -h require a NAME argument. | 70 | All options except -i and -h require a NAME argument. |
65 | 71 | ||
66 | options: | 72 | options: |
@@ -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 |