summaryrefslogtreecommitdiff
path: root/src/completion/pass.zsh-completion
diff options
context:
space:
mode:
Diffstat (limited to 'src/completion/pass.zsh-completion')
-rw-r--r--src/completion/pass.zsh-completion116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion
new file mode 100644
index 0000000..0bb14de
--- /dev/null
+++ b/src/completion/pass.zsh-completion
@@ -0,0 +1,116 @@
+#compdef pass
+
+# Copyright (C) 2012:
+# Johan Venant <jvenant@invicem.pro>
+# Brian Mattern <rephorm@rephorm.com>
+# Jason A. Donenfeld <Jason@zx2c4.com>.
+# All Rights Reserved.
+# This file is licensed under the GPLv2+. Please see COPYING for more information.
+
+_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
+ case "${cmd}" in
+ init)
+ _arguments : \
+ "-r[re-encrypt existing passwords]" \
+ "--reencrypt[re-encrypt existing passwords]"
+ _pass_complete_keys
+ ;;
+ ls|list|edit)
+ _pass_complete_entries_with_subdirs
+ ;;
+ insert)
+ _arguments : \
+ "-e[echo password to console]" \
+ "--echo[echo password to console]" \
+ "-m[multiline]" \
+ "--multiline[multiline]"
+ _pass_complete_entries_with_subdirs
+ ;;
+ generate)
+ _arguments : \
+ "-n[don't include symbols in password]" \
+ "--no-symbols[don't include symbols in password]" \
+ "-c[copy password to the clipboard]" \
+ "--clip[copy password to the clipboard]"
+ _pass_complete_entries_with_subdirs
+ ;;
+ rm)
+ _arguments : \
+ "-f[force deletion]" \
+ "--force[force deletion]" \
+ "-r[recursively delete]" \
+ "--recursive[recursively delete]"
+ _pass_complete_entries_with_subdirs
+ ;;
+ git)
+ local -a subcommands
+ subcommands=(
+ "init:Initialize git repository"
+ "push:Push to remote repository"
+ "pull:Pull from remote repository"
+ "config:Show git config"
+ "log:Show git log"
+ "reflog:Show git reflog"
+ )
+ _describe -t commands 'pass git' subcommands
+ ;;
+ show|*)
+ _pass_cmd_show
+ ;;
+ esac
+ else
+ local -a subcommands
+ subcommands=(
+ "init:Initialize new password storage"
+ "ls:List 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"
+ "git:Call git on the password store"
+ "version:Output version information"
+ "help:Output help message"
+ )
+ _describe -t commands 'pass' subcommands
+ _arguments : \
+ "--version[Output version information]" \
+ "--help[Output help message]"
+ _pass_cmd_show
+ fi
+}
+
+_pass_cmd_show () {
+ _arguments : \
+ "-c[put it on the clipboard]" \
+ "--clip[put it on the clipboard]"
+ _pass_complete_entries
+}
+_pass_complete_entries_helper () {
+ local IFS=$'\n'
+ local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ _values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
+}
+
+_pass_complete_entries_with_subdirs () {
+ _pass_complete_entries_helper
+}
+
+_pass_complete_entries () {
+ _pass_complete_entries_helper -type f
+}
+
+_pass_complete_keys () {
+ local IFS=$'\n'
+ # Extract names and email addresses from gpg --list-keys
+ _values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
+}
nstead of inline strings.René 'Necoro' Neumann6-74/+79 They should also use CRLF (cf issue #46). 2021-02-16Issue #46: Fix semantics of `n` resultRené 'Necoro' Neumann2-9/+15 Per contract, the returned number of bytes written should be the number of bytes _from the input_. Therefore, the added bytes (`\r` or `\n`) shall not count into that number. 2021-02-16Issue #46: Move and rename writer; add commentsRené 'Necoro' Neumann3-12/+21 2021-02-15Issue #46: Improvements; add testsRené 'Necoro' Neumann2-1/+48 2021-02-15Bump github.com/google/uuid from 1.1.4 to 1.2.0dependabot[bot]2-3/+3 Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.4 to 1.2.0. - [Release notes](https://github.com/google/uuid/releases) - [Commits](https://github.com/google/uuid/compare/v1.1.4...v1.2.0) Signed-off-by: dependabot[bot] <support@github.com> 2021-02-15Issue #46: Make the resulting email body not to include single \r or \n. ↵René 'Necoro' Neumann2-2/+66 This now pleases Cyrus IMAP. 2021-01-20Bump github.com/PuerkitoBio/goquery from 1.6.0 to 1.6.1dependabot[bot]2-3/+3 Bumps [github.com/PuerkitoBio/goquery](https://github.com/PuerkitoBio/goquery) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/PuerkitoBio/goquery/releases) - [Commits](https://github.com/PuerkitoBio/goquery/compare/v1.6.0...v1.6.1) Signed-off-by: dependabot[bot] <support@github.com> 2021-01-09Bump github.com/google/uuid from 1.1.2 to 1.1.4dependabot[bot]2-3/+3 Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.1.2 to 1.1.4. - [Release notes](https://github.com/google/uuid/releases) - [Commits](https://github.com/google/uuid/compare/v1.1.2...v1.1.4) Signed-off-by: dependabot[bot] <support@github.com> 2021-01-09Bump github.com/emersion/go-message from 0.14.0 to 0.14.1 (#42)dependabot[bot]2-3/+3 Bumps [github.com/emersion/go-message](https://github.com/emersion/go-message) from 0.14.0 to 0.14.1. - [Release notes](https://github.com/emersion/go-message/releases) - [Commits](https://github.com/emersion/go-message/compare/v0.14.0...v0.14.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2020-11-28Bump github.com/emersion/go-message from 0.13.0 to 0.14.0 (#38)dependabot[bot]2-3/+9 Bumps [github.com/emersion/go-message](https://github.com/emersion/go-message) from 0.13.0 to 0.14.0. - [Release notes](https://github.com/emersion/go-message/releases) - [Commits](https://github.com/emersion/go-message/compare/v0.13.0...v0.14.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2020-11-28Bump github.com/google/go-cmp from 0.5.2 to 0.5.4 (#37)dependabot[bot]2-3/+3 Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.2 to 0.5.4. - [Release notes](https://github.com/google/go-cmp/releases) - [Commits](https://github.com/google/go-cmp/compare/v0.5.2...v0.5.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2020-11-23Fix release.ymlv0.5.2René 'Necoro' Neumann1-3/+10 2020-11-23Prepare v0.5.2René 'Necoro' Neumann3-3/+8 2020-11-20Bump github.com/gabriel-vasile/mimetype from 1.1.1 to 1.1.2dependabot[bot]2-3/+3 Bumps [github.com/gabriel-vasile/mimetype](https://github.com/gabriel-vasile/mimetype) from 1.1.1 to 1.1.2. - [Release notes](https://github.com/gabriel-vasile/mimetype/releases) - [Changelog](https://github.com/gabriel-vasile/mimetype/blob/master/CHANGELOG.md) - [Commits](https://github.com/gabriel-vasile/mimetype/compare/v1.1.1...v1.1.2) Signed-off-by: dependabot[bot] <support@github.com> 2020-11-04Clean dependabot.ymlRené 'Necoro' Neumann1-4/+0