1#compdef tpm 2# Copyright (C) 2013-2015 Sören Tempel 3# 4# This program is free software: you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation, either version 3 of the License, or 7# (at your option) any later version. 8# 9# This program is distributed in the hope that it will be useful,10# but WITHOUT ANY WARRANTY; without even the implied warranty of11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12# GNU General Public License for more details.13#14# You should have received a copy of the GNU General Public License15# along with this program. If not, see <http://www.gnu.org/licenses/>.1617_tpm() {18 local cmd=${words[2]}1920 case "${cmd}" in21 "insert")22 _tpm_complete_entries23 ;;24 "show")25 _tpm_complete_entries -type f26 ;;27 *)28 local subcommands=(29 "show:Show a password for a specified entry"30 "insert:Insert a new password entry"31 )3233 _describe -t commands "tpm" subcommands34 ;;35 esac36}3738_tpm_complete_entries() {39 local dir="${PASSWORD_STORE_DIR:-${HOME}/.password-store}"4041 if [[ -d "${dir}" ]]; then42 _values -C "entries" \43 $(find -L "${dir}/" -name ".git" -prune -o $@ -print | sed -e "s|${dir}.||" -e "s|\.gpg||" | sort)44 fi45}4647# vim: et:sw=2:sts=2