summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2020-06-25 23:41:11 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-06-25 15:43:30 -0600
commit06f499994071bb6131244218b25d637103afe1d5 (patch)
treef5c49194b47d43dfed139dfef789c4d3ca8f7777
parente50b18a049c54fb9b8dc2507238c08c1c8bd3fa9 (diff)
downloadpass-06f499994071bb6131244218b25d637103afe1d5.tar.gz
pass-06f499994071bb6131244218b25d637103afe1d5.tar.bz2
pass-06f499994071bb6131244218b25d637103afe1d5.zip
fish-completion: reuse "git" and "grep" completions
This makes fish complete commands starting with "pass git" as if they were starting with "git".
Diffstat (limited to '')
-rw-r--r--src/completion/pass.fish-completion20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/completion/pass.fish-completion b/src/completion/pass.fish-completion
index 0c67bf3..3e70af1 100644
--- a/src/completion/pass.fish-completion
+++ b/src/completion/pass.fish-completion
@@ -52,6 +52,12 @@ function __fish_pass_print_entries_and_dirs
__fish_pass_print_entries
end
+function __fish_pass_git_complete
+ set -l prefix (__fish_pass_get_prefix)
+ set -l git_cmd (commandline -opc) (commandline -ct)
+ set -e git_cmd[1 2] # Drop "pass git".
+ complete -C"git -C $prefix $git_cmd"
+end
complete -c $PROG -f -n '__fish_pass_needs_command' -a help -d 'Command: show usage help'
complete -c $PROG -f -n '__fish_pass_needs_command' -a version -d 'Command: show program version'
@@ -101,13 +107,11 @@ complete -c $PROG -f -n '__fish_pass_uses_command -c' -a "(__fish_pass_print_ent
complete -c $PROG -f -n '__fish_pass_uses_command --clip' -a "(__fish_pass_print_entries)"
complete -c $PROG -f -n '__fish_pass_needs_command' -a git -d 'Command: execute a git command'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'init' -d 'Initialize git repository'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'status' -d 'Show status of the repo'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'add' -d 'Add changes to the index'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'commit' -d 'Commit changes to the repo'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'push' -d 'Push changes to remote repo'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'pull' -d 'Pull changes from remote repo'
-complete -c $PROG -f -n '__fish_pass_uses_command git' -a 'log' -d 'View changelog'
-
+complete -c $PROG -f -n '__fish_pass_uses_command git' -a '(__fish_pass_git_complete)'
complete -c $PROG -f -n '__fish_pass_needs_command' -a find -d 'Command: find a password file or directory matching pattern'
complete -c $PROG -f -n '__fish_pass_needs_command' -a grep -d 'Command: search inside of decrypted password files for matching pattern'
+complete -c $PROG -f -n '__fish_pass_uses_command grep' -a '(begin
+ set -l cmd (commandline -opc) (commandline -ct)
+ set -e cmd[1 2] # Drop "pass grep".
+ complete -C"grep $cmd"
+end)'
bcc32ffce058b860d5a473b98&follow=1'>Abstract remove empty directories into function.Jason A. Donenfeld1-14/+11 2014-04-18Remember to prune empty folders.Jason A. Donenfeld1-0/+8 2014-04-18init: allow deinitializationJason A. Donenfeld2-2/+18 2014-04-18bash-completion: filter dot files from resultsJason A. Donenfeld1-3/+8 2014-04-18reencrypt: remove option, do automaticallyJason A. Donenfeld5-39/+25 2014-04-18reencryption: add to completion filesJason A. Donenfeld3-1/+5 2014-04-18Specify variable gpg.Jason A. Donenfeld1-1/+1 2014-04-18style: don't escape new line on &&Jason A. Donenfeld1-2/+2 2014-04-18reencryption: remove temporary file on failureJason A. Donenfeld1-1/+1 2014-04-18reencryption: only reencrypt files when requiredJason A. Donenfeld2-16/+37 2014-04-17cp: typo as cvJason A. Donenfeld1-1/+1 2014-04-17bash: gpg_id is localJason A. Donenfeld1-0/+1 2014-04-17move/copy: always reencrypt passwords at destinationJason A. Donenfeld5-25/+56 2014-04-17makefile: allow platform files with gnu sedJason A. Donenfeld1-7/+8 2014-04-17mv: Add pass mv/rename supportJason A. Donenfeld5-3/+78 2014-04-17revelation2pass: add plain XML importJavali1-11/+15 2014-04-17platform: add cygwin supportJason A. Donenfeld2-1/+17