076f7f1eb19914877e49eb186eb076fc3e493b36
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
fix(genpass): warn if no wordlist is found
Diff
1diff --git a/plugins/genpass/genpass.plugin.zsh b/plugins/genpass/genpass.plugin.zsh
2index f1ad80bbad395c0c1d5aa140c6aaf7e192d48e67..1353ef4567bb67263a052fb53db1c68b68fec3fb 100644
3--- a/plugins/genpass/genpass.plugin.zsh
4+++ b/plugins/genpass/genpass.plugin.zsh
5@@ -73,7 +73,7 @@ genpass-monkey() {
6
7 genpass-xkcd() {
8 # Generates a 128-bit XKCD-style passphrase
9- # EG, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
10+ # e.g, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
11 # Can take a numerical argument for generating extra passwords
12
13 if (( ! $+commands[shuf] )); then
14@@ -81,6 +81,11 @@ genpass-xkcd() {
15 return 1
16 fi
17
18+ if [[ ! -e /usr/share/dict/words ]]; then
19+ echo >&2 "$0: no wordlist found in \`/usr/share/dict/words\`. Install one first."
20+ return 1
21+ fi
22+
23 local -i i num
24
25 [[ $1 =~ '^[0-9]+$' ]] && num=$1 || num=1