6caed46356fe63a25bb859c6b8f523a87b9463fe

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #2941 from mcornella/fix-pass-completion

Update pass completion and fix syntax and autoloading

Diff

 1diff --git a/plugins/pass/_pass b/plugins/pass/_pass
 2index d8ec388280bb7667d5bdce80de6f229be8c3a454..7a9b1f955e86f1da380f9ae2e47883e04b9026ff 100644
 3--- a/plugins/pass/_pass
 4+++ b/plugins/pass/_pass
 5@@ -1,13 +1,16 @@
 6 #compdef pass
 7 #autoload
 8 
 9-# Copyright (C) 2012:
10+# Copyright (C) 2012 - 2014:
11 #    Johan Venant <jvenant@invicem.pro>
12 #    Brian Mattern <rephorm@rephorm.com>
13 #    Jason A. Donenfeld <Jason@zx2c4.com>.
14-#    Santiago Borrazás <sanbor@gmail.com>
15 # All Rights Reserved.
16-# This file is licensed under the GPLv2+. Please see COPYING for more information.
17+#
18+# This file is licensed under the GPLv2+.
19+# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information.
20+#
21+# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com>
22 
23 
24 _pass () {
25@@ -23,8 +26,8 @@ _pass () {
26 		case "${cmd}" in
27 			init)
28 				_arguments : \
29-					"-r[re-encrypt existing passwords]" \
30-					"--reencrypt[re-encrypt existing passwords]"
31+					"-p[gpg-id will only be applied to this subfolder]" \
32+					"--path[gpg-id will only be applied to this subfolder]"
33 				_pass_complete_keys
34 				;;
35 			ls|list|edit)
36@@ -43,9 +46,19 @@ _pass () {
37 					"-n[don't include symbols in password]" \
38 					"--no-symbols[don't include symbols in password]" \
39 					"-c[copy password to the clipboard]" \
40-					"--clip[copy password to the clipboard]"
41+					"--clip[copy password to the clipboard]" \
42+					"-f[force overwrite]" \
43+					"--force[force overwrite]" \
44+					"-i[replace first line]" \
45+					"--in-place[replace first line]"
46 				_pass_complete_entries_with_subdirs
47 				;;
48+			cp|copy|mv|rename)
49+				_arguments : \
50+					"-f[force rename]" \
51+					"--force[force rename]"
52+					_pass_complete_entries_with_subdirs
53+				;;
54 			rm)
55 				_arguments : \
56 					"-f[force deletion]" \
57@@ -75,10 +88,14 @@ _pass () {
58 		subcommands=(
59 			"init:Initialize new password storage"
60 			"ls:List passwords"
61+			"find:Find password files or directories based on pattern"
62+			"grep:Search inside decrypted password files for matching pattern"
63 			"show:Decrypt and print a password"
64 			"insert:Insert a new password"
65 			"generate:Generate a new password using pwgen"
66 			"edit:Edit a password with \$EDITOR"
67+			"mv:Rename the password"
68+			"cp:Copy the password"
69 			"rm:Remove the password"
70 			"git:Call git on the password store"
71 			"version:Output version information"
72@@ -101,7 +118,7 @@ _pass_cmd_show () {
73 _pass_complete_entries_helper () {
74 	local IFS=$'\n'
75 	local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
76-	_values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
77+	_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' | sort):-""}
78 }
79 
80 _pass_complete_entries_with_subdirs () {
81@@ -117,3 +134,5 @@ _pass_complete_keys () {
82 	# Extract names and email addresses from gpg --list-keys
83 	_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
84 }
85+
86+_pass