aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnirudh Oppiliappan <x@icyphox.sh>2019-11-18 10:22:22 +0530
committerAnirudh Oppiliappan <x@icyphox.sh>2019-11-18 10:22:22 +0530
commit1f8f54198a72a8b76c61e0d80db78ed7014747a5 (patch)
tree059b01d30acd5fb23c1b9b8ce0a1f4f12fa43082
parenta5e5d403482e8fccf7d1f1502bbf1d72962be9d2 (diff)
downloadpw-1f8f54198a72a8b76c61e0d80db78ed7014747a5.tar.gz
Use PW_LEN to override default pw length
Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
-rwxr-xr-xpw4
-rw-r--r--readme.md3
2 files changed, 5 insertions, 2 deletions
diff --git a/pw b/pw
index c22f7d7..b6197f6 100755
--- a/pw
+++ b/pw
@@ -22,7 +22,8 @@ add() {
22 if [[ "$#" -eq 2 ]]; then 22 if [[ "$#" -eq 2 ]]; then
23 pass="$2" 23 pass="$2"
24 else 24 else
25 pass="$(pwgen 25 1 -s)" 25 # uses default length of 25 chars, unless PW_LEN is set
26 pass="$(pwgen ${PW_LEN:-25} 1 -s)"
26 echo "pw: generated password for $1" 27 echo "pw: generated password for $1"
27 fi 28 fi
28 if [[ ! -f "$PW_DIR/$1.gpg" ]]; then 29 if [[ ! -f "$PW_DIR/$1.gpg" ]]; then
@@ -80,6 +81,7 @@ options:
80 -h Display this help message and exit. 81 -h Display this help message and exit.
81 82
82Requires PW_KEY to be set. Optionally, set PW_DIR for custom directory location. 83Requires PW_KEY to be set. Optionally, set PW_DIR for custom directory location.
84Set PW_LEN to an integer of your choice, to override the default password length of 25.
83" 85"
84 86
85 echo "$usage" 87 echo "$usage"
diff --git a/readme.md b/readme.md
index 8776ea1..c9e23b7 100644
--- a/readme.md
+++ b/readme.md
@@ -18,7 +18,8 @@ export PW_KEY=user@mail.id
18This is your GPG key's associated email ID. 18This is your GPG key's associated email ID.
19 19
20Optionally, you may set `PW_DIR` to your desired path to change the 20Optionally, you may set `PW_DIR` to your desired path to change the
21default password store location, which is `~/.pw`. 21default password store location, which is `~/.pw`. To override the
22default password length of 25, set `PW_LEN` to a number of your choice.
22 23
23``` 24```
24pw - mnml password manager 25pw - mnml password manager