aboutsummaryrefslogtreecommitdiff
path: root/pw
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 /pw
parenta5e5d403482e8fccf7d1f1502bbf1d72962be9d2 (diff)
downloadpw-1f8f54198a72a8b76c61e0d80db78ed7014747a5.tar.gz
Use PW_LEN to override default pw length
Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Diffstat (limited to 'pw')
-rwxr-xr-xpw4
1 files changed, 3 insertions, 1 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"