diff options
author | Patrick Harrison <mestizo@gmail.com> | 2020-12-14 09:52:02 +0700 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2020-12-14 15:52:14 +0100 |
commit | 619097cc2ad31c1b5086870293739d41dd4129c3 (patch) | |
tree | 9840392fef44cabf2a71ecb5b029862d0e6d6142 /plugins/genpass/genpass.plugin.zsh | |
parent | 2a0ae3315db98d137de547e2cb9adfbc38263e6c (diff) | |
download | zsh-619097cc2ad31c1b5086870293739d41dd4129c3.tar.gz zsh-619097cc2ad31c1b5086870293739d41dd4129c3.tar.bz2 zsh-619097cc2ad31c1b5086870293739d41dd4129c3.zip |
fix(genpass): check for presence of shuf command.
"shuf" is not a standard command on MacOS and requires installation of the brew coreutils package
Diffstat (limited to 'plugins/genpass/genpass.plugin.zsh')
-rw-r--r-- | plugins/genpass/genpass.plugin.zsh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/genpass/genpass.plugin.zsh b/plugins/genpass/genpass.plugin.zsh index e7f86bf7a..f1ad80bba 100644 --- a/plugins/genpass/genpass.plugin.zsh +++ b/plugins/genpass/genpass.plugin.zsh @@ -75,6 +75,12 @@ genpass-xkcd() { # Generates a 128-bit XKCD-style passphrase # EG, 9-mien-flood-Patti-buxom-dozes-ickier-pay-ailed-Foster # Can take a numerical argument for generating extra passwords + + if (( ! $+commands[shuf] )); then + echo >&2 "$0: \`shuf\` command not found. Install coreutils (\`brew install coreutils\` on macOS)." + return 1 + fi + local -i i num [[ $1 =~ '^[0-9]+$' ]] && num=$1 || num=1 |