summaryrefslogtreecommitdiff
path: root/contrib/pass.zsh-completion
blob: 5cf880872326949e44f11b2152fdfd9dc5446c78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#compdef pass

# This file is under the GPLv2+ license.
# Heavily based on http://zsh.sf.net/Guide/zshguide06.html#l177
# And Frédéric Perrin article http://tar-jx.bz/notes/zsh-completion.html
# Johan Venant, September 2012


_pass () {
  local cmd
  if (( CURRENT > 2)); then
    cmd=${words[2]}
    # Set the context for the subcommand.
    curcontext="${curcontext%:*:*}:pass-$cmd"
    # Narrow the range of words we are looking at to exclude `pass'
    (( CURRENT-- ))
    shift words
    # Run the completion for the subcommand
    (( $+functions[_pass_cmd_$cmd] )) && _pass_cmd_$cmd

  else
    _values 'command' \
      "init[Initialize new password storage]" \
      "ls[subfolder List names of passwords]" \
      "show[Decrypt and print a password]" \
      "insert[Insert a new password]" \
      "generate[Generate a new password using pwgen]" \
      "edit[Edit a password with \$EDITOR]" \
      "rm[Remove the password]" \
      "push[push the latest changes using git-push(1)]" \
      "pull[pull the latest changes using git-pull(1)]" \
      "git[Call git]" \
      "help[Help]"
    _pass_cmd_show
  fi
}

_pass_cmd_init () {
}

_pass_cmd_ls () {
  _arguments : \
    '::ls:_get_stored_pwd'
}

_pass_cmd_show () {
  _arguments : \
    "-c[put it on the clipboard]" \
    '*::show:_get_stored_pwd'
    #'::pass id:_files -W ~/.password-store -g "*.gpg(|.*)(-.)"'
}

_pass_cmd_edit () {
  _arguments : \
    '::edit:_get_stored_pwd'
}

_pass_cmd_insert () {
  _arguments : \
    "-n[no console output]" \
    "-m[multiline]" \
    '::show:_get_stored_pwd'
}

_pass_cmd_generate () {
  _arguments : \
    "-n[no symbols]" \
    "-c[put password on the clipboard]" \
    '::show:_get_stored_pwd'
}

_pass_cmd_rm () {
  _arguments : \
    '::ls:_get_stored_pwd'
}

_get_stored_pwd () {
  compadd `find ~/.password-store \( -name .git -o -name .gpg-id \) -prune -o -type f -print | sed 's#.*\.password-store*.##'| sed 's#\.gpg##' | sort`

}
password-store.sh?h=1.7.4&id=60e1fa752f218616e04648a21578fe346fe36a6d&follow=1'>Simplify exports.Jason A. Donenfeld1-4/+3 2014-03-19Copyright noticeJason A. Donenfeld1-1/+1 2014-03-19Team pass: enable multiple keys and per directoryJason A. Donenfeld2-40/+75 The .gpg-id file may now have multiple keys in it, one per line. If a .gpg-id file exists inside a subdirectory, passwords inside that directory are encrypted to that/those ids. The init command has learned a -p/--path option for writing such a sub directory .gpg-id and now can take several arguments for ids. 2014-03-18Shred shm files.Jason A. Donenfeld3-1/+4 2014-03-18Do not compress passwords.Jason A. Donenfeld1-1/+1 According to a forthcoming paper by Alfredo Pironti, OpenPGP compression can reveal entropy levels. We thus disable compression. Existing password stores can be reencrypted without compression using the "--reencrypt" flag for "init". Reported-by: Alfredo Pironti <alfredo.pironti@inria.fr> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> 2013-09-14Use a glob in the pattern match instead of using two comparisons for [yY].Chris Down1-1/+1 2013-09-14Rephrase awkward/confusing message about enabling echo during password entry.Chris Down1-3/+3 2013-09-14Fix directory traversal for reencryption when $PREFIX is a symlinkBrian Shore1-1/+1 2013-08-26Makefile: Do not install bash completion to /etcLukas Fleischer1-3/+2 `make install` should never install anything to /etc. "/usr/share/bash-completion/completions/" is the right place for completions that are installed by software packages. Signed-off-by: Lukas Fleischer <info@cryptocrack.de> 2013-05-22check if a passfile exists before checking for directoryBrian Mattern1-13/+12