spm

Personal fork of spm (simple password manager)
git clone git@getsh.org:spm.git
Log | Files | Refs | README | LICENSE

commit eb588fdbd0daadd6528c9f107062ff54f7795b4c
parent 5834cd5fd3318501cc5af3129a93ba2a2daeec9b
Author: nmeum <git-nmeum@8pit.net>
Date:   Tue, 25 Mar 2014 10:24:30 +0100

Make sure that the dir exists before invoking find

Diffstat:
Mbash_completion | 7+++++--
Mzsh_completion | 5++++-
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/bash_completion b/bash_completion @@ -13,8 +13,11 @@ _tpm() { _tpm_complete_entries() { local dir="${TPM_STORE_DIR:-${HOME}/.password-store}" - local files="$(find "${dir}/" $@ -print | sed -e "s^${dir}.^^" -e 's^\.gpg^^' | sort)" - COMPREPLY=($(compgen -W "${files}" -- ${cur})) + + if [[ -d "${dir}" ]]; then + local files="$(find "${dir}/" $@ -print | sed -e "s^${dir}.^^" -e 's^\.gpg^^' | sort)" + COMPREPLY=($(compgen -W "${files}" -- ${cur})) + fi } complete -F _tpm tpm diff --git a/zsh_completion b/zsh_completion @@ -19,5 +19,8 @@ _tpm() { _tpm_complete_entries() { local dir="${TPM_STORE_DIR:-${HOME}/.password-store}" - _values -C 'entries' $(find "${dir}/" $@ -print | sed -e "s^${dir}.^^" -e 's^\.gpg^^' | sort) + + if [[ -d "${dir}" ]]; then + _values -C 'entries' $(find "${dir}/" $@ -print | sed -e "s^${dir}.^^" -e 's^\.gpg^^' | sort) + fi }