password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit 4311b7728ec75eb9cf08302c57376ad0a46673a8
parent 5f12b6443d362a3949f0c289d59c3acf2bc6c649
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Thu, 26 Jul 2012 19:54:37 +0200

Add rudimentry bash-completion script. Needs work.

Diffstat:
Abash-completion.sh | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/bash-completion.sh b/bash-completion.sh @@ -0,0 +1,28 @@ +#!/bin/bash +_pass() +{ + local cur prev prefix suffix gen + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + prefix="$HOME/.password-store/" + suffix=".gpg" + + if [[ $prev == --* ]]; then + return 0 + fi + + for item in $(compgen -f $prefix$cur); do + if [[ $item == $prefix.* ]]; then + continue + fi + if [[ -d $item ]]; then + item="$item/" + fi + item="${item%$suffix}" + gen="$gen ${item#$prefix}" + done + + COMPREPLY=( $gen ) +} +complete -o filenames -o nospace -F _pass pass