Hi,

I did a similar project, just because i have to many passwords and i
cant handle them without a fuzzy search any more.

    https://github.com/d4ndo/pass

It is using the bash completion and the user can choose the fuzzy search
tool by setting an environment variable in the bashrc.

e.G. export PASSWORD_STORE_FUZZY="peco"

Just use pass -c **<TAB> and start the fuzzy search for your passwords.

Cheers.

See patch:


Am 24.03.2018 um 06:06 schrieb Nobutarou Nosuke:
> Hi,
>
> This is my first post. I recently started password-store. I soon like
> it. How simple is it? It is just a text file. This gives me the best
> freedom. I can save any info!
>
> But I also feel that I want incremental search. Then I start to write
> a simple script, passpeco, here,
>
>       https://github.com/Nobutarou/passpeco
>
>
> Do you know peco, https://github.com/peco/peco ? It is really nice
> filtering tool on console. And it is very friendly with pass.
>
> Maybe you have already made your pass very comfortable for you. Maybe
> better than my script. But if this could give you some help, I would
> be grad.
>
> Thanks,
> _______________________________________________
> Password-Store mailing list
> [email protected]
> https://lists.zx2c4.com/mailman/listinfo/password-store

diff --git a/README.MD b/README.MD
new file mode 100644
index 0000000..9c83b2e
--- /dev/null
+++ b/README.MD
@@ -0,0 +1,64 @@
+This is a fork/patch to add fuzzy search functionality to password-store.
+
+![Screencast](out.gif)
+
+#Usage:
+
+Type `pass **` and hit tabulator to start the fuzzy search. Hit Return or Ctrl+Return to select the password.
+ 
+```bash
+pass **<TAB>
+```
+#Install:
+
+Choose one of the recommended fuzzy search commands listed below:
+
+Recommended:
+
+- fzf (Go)
+  https://github.com/junegunn/fzf
+- pick (C) (Press Ctrl + Return to select password)
+  https://github.com/thoughtbot/pick
+- icepick (Rust) (Press Ctrl + Return to select password)
+  https://github.com/felipesere/icepick
+- selecta (Ruby) (Press Ctrl + Return to select password)
+  https://github.com/garybernhardt/selecta
+- peco (Go)
+  https://github.com/peco/peco
+
+Clone this repository : 
+
+```bash
+git clone https://github.com/d4ndo/password-store.git
+cd password-store
+make install-common
+```
+
+Set the fuzzy search command for password-store to use in .bashrc. In this example it is `PASSWORD_STORE_FUZZY="fzf"`.
+
+~.bashrc
+
+```bash
+export PASSWORD_STORE_FUZZY="fzf"
+source "/usr/share/bash-completion/completions/pass"
+```
+
+Troubleshooting: Set the source where to find bash completion.
+
+
+Depends on:
+
+- bash
+  http://www.gnu.org/software/bash/
+- GnuPG2
+  http://www.gnupg.org/
+- git
+  http://www.git-scm.com/
+- xclip
+  http://sourceforge.net/projects/xclip/
+- tree >= 1.7.0
+  http://mama.indstate.edu/users/ice/tree/
+- GNU getopt
+  http://www.kernel.org/pub/linux/utils/util-linux/
+  http://software.frodo.looijaard.name/getopt/
+	
diff --git a/man/pass.1 b/man/pass.1
index e842178..b5a2e54 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -427,6 +427,10 @@ Specifies the number of seconds to wait before restoring the clipboard, by defau
 .I PASSWORD_STORE_UMASK
 Sets the umask of all files modified by pass, by default \fI077\fP.
 .TP
+.I PASSWORD_STORE_FUZZY
+Sets the fuzzy search command. "fzf", "pick", "icepick", "selecta", "peco".
+Usage: \fBpass **<TAB>\fP.
+.TP
 .I PASSWORD_STORE_GENERATED_LENGTH
 The default password length if the \fIpass-length\fP parameter to \fBgenerate\fP
 is unspecified.
diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
index 456485b..c759c9e 100644
--- a/src/completion/pass.bash-completion
+++ b/src/completion/pass.bash-completion
@@ -82,6 +82,20 @@ _pass()
 	COMPREPLY=()
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 	local commands="init ls find grep show insert generate edit rm mv cp git help version"
+	local fuzzycmd="${PASSWORD_STORE_FUZZY}"
+	local pwdir="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+	local stringsize="${#pwdir}"
+	let "stringsize+=1"
+	trigger="**"
+
+	if [[ ${COMP_WORDS[COMP_CWORD]} == "$trigger" ]]; then
+		tput sc
+		COMPREPLY=($(find "$pwdir" -name "*.gpg" | cut -c "$stringsize"- | sed -e 's/\(.*\)\.gpg/\1/' |	"$fuzzycmd" | tr "\n" ' '))
+		tput rc
+		#_pass_complete_entries
+		return 0
+	fi
+
 	if [[ $COMP_CWORD -gt 1 ]]; then
 		local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
 		case "${COMP_WORDS[1]}" in
_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to