Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
password-store
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Karl Fogel
password-store
Commits
7df1e2de
Commit
7df1e2de
authored
10 years ago
by
Jason A. Donenfeld
Browse files
Options
Downloads
Patches
Plain Diff
bash-completion: complete the new init -p switch.
parent
99202dde
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/completion/pass.bash-completion
+19
-6
19 additions, 6 deletions
src/completion/pass.bash-completion
with
19 additions
and
6 deletions
src/completion/pass.bash-completion
+
19
−
6
View file @
7df1e2de
# completion file for bash
# Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com> and
# Copyright (C) 2012
- 2014
Jason A. Donenfeld <Jason@zx2c4.com> and
# Brian Mattern <rephorm@rephorm.com>. All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
...
...
@@ -12,9 +12,7 @@ _pass_complete_entries () {
local IFS=$'\n'
local items=($(compgen -f $prefix$cur))
for item in ${items[@]}; do
if [[ $item == $prefix.* ]]; then
continue
fi
[[ $item == $prefix.* ]] && continue
# if there is a unique match, and it is a directory with one entry
# autocomplete the subentry as well (recursively)
...
...
@@ -37,6 +35,17 @@ _pass_complete_entries () {
done
}
_pass_complete_folders () {
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
local IFS=$'\n'
local items=($(compgen -d $prefix$cur))
for item in ${items[@]}; do
[[ $item == $prefix.* ]] && continue
COMPREPLY+=("${item#$prefix}/")
done
}
_pass_complete_keys () {
local IFS=$'\n'
# Extract names and email addresses from gpg --list-keys
...
...
@@ -52,8 +61,12 @@ _pass()
if [[ $COMP_CWORD -gt 1 ]]; then
case "${COMP_WORDS[1]}" in
init)
COMPREPLY+=($(compgen -W "-e --reencrypt" -- ${cur}))
_pass_complete_keys
COMPREPLY+=($(compgen -W "-e --reencrypt -p --path" -- ${cur}))
if [[ ${COMP_WORDS[$COMP_CWORD-1]} == "-p" || ${COMP_WORDS[$COMP_CWORD-1]} == "--path" ]]; then
_pass_complete_folders
else
_pass_complete_keys
fi
;;
ls|list|edit)
_pass_complete_entries
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment