all repos — pw @ 5c459f413cfe812ffeeeeebee37c819a0163a659

minimal password store

Add new `-l` flag to list out pws

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Sun, 17 Nov 2019 15:19:41 +0530
commit

5c459f413cfe812ffeeeeebee37c819a0163a659

parent

0a5b7244b36afce7b95e77d1ce8acda600513a9a

1 files changed, 10 insertions(+), 2 deletions(-)

jump to
M pwpw

@@ -33,6 +33,12 @@ die "the file $PW_DIR/$1.gpg exists"

fi } +list() { + for f in "$PW_DIR"/*.gpg; do + printf '%s\n' "$(basename ${f%.gpg})" + done +} + del() { checkf "$PW_DIR/$1.gpg" read -rn 1 -p "pw: are you sure you want to delete $1? [y/n]: "

@@ -60,7 +66,7 @@ usage() {

usage=" pw - mnml password manager -usage: pw [options] +usage: pw [options] [NAME] All options except -i and -h require a NAME argument. options:

@@ -68,6 +74,7 @@ -i Initializes password directory at \$HOME/.pw or at \$PW_DIR, if it exists.

-a Add a password. -g Generate a password. -s Print password to STDOUT. + -l List out all passwords. -c Copy existing password to clipboard. -d Delete password. -h Display this help message and exit.

@@ -95,10 +102,11 @@ [[ -z "$1" ]] && {

usage } - while getopts "ia:g:s:c:d:h" options + while getopts "ila:g:s:c:d:h" options do case "$options" in i) init ;; + l) list ;; g) add "$OPTARG" ;; a) read -rsp "enter password: " pass