619097cc2ad31c1b5086870293739d41dd4129c3
- Author
- Patrick Harrison <mestizo@gmail.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
fix(genpass): check for presence of shuf command.
"shuf" is not a standard command on MacOS and requires installation of the brew coreutils package
Diff
1diff --git a/plugins/genpass/genpass.plugin.zsh b/plugins/genpass/genpass.plugin.zsh
2index e7f86bf7a1a4dd46ba0426e9152f21b4212dad37..f1ad80bbad395c0c1d5aa140c6aaf7e192d48e67 100644
3--- a/plugins/genpass/genpass.plugin.zsh
4+++ b/plugins/genpass/genpass.plugin.zsh
5@@ -75,6 +75,12 @@ genpass-xkcd() {
6 # Generates a 128-bit XKCD-style passphrase
7 # EG, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster
8 # Can take a numerical argument for generating extra passwords
9+
10+ if (( ! $+commands[shuf] )); then
11+ echo >&2 "$0: \`shuf\` command not found. Install coreutils (\`brew install coreutils\` on macOS)."
12+ return 1
13+ fi
14+
15 local -i i num
16
17 [[ $1 =~ '^[0-9]+$' ]] && num=$1 || num=1