Update everything that uses pass to use gopass
This commit is contained in:
parent
3bd387c0aa
commit
0755d8f086
6 changed files with 9 additions and 33 deletions
|
|
@ -1,31 +1,7 @@
|
|||
from os.path import isdir, join
|
||||
|
||||
ROOT = ${...}.get('PASSWORD_STORE_DIR', $HOME + '/.password-store')
|
||||
SUFFIX = '.gpg'
|
||||
|
||||
def make_display(directory):
|
||||
def display(completion):
|
||||
if isdir(join(ROOT, directory, completion)):
|
||||
return completion + '/'
|
||||
if completion.endswith(SUFFIX):
|
||||
return join(directory, completion[:-len(SUFFIX)])
|
||||
return completion
|
||||
return display
|
||||
|
||||
def passget_completer(prefix, line, begidx, endidx, ctx):
|
||||
if not line.startswith('passget'): return {}
|
||||
|
||||
directory = ''
|
||||
|
||||
if '/' in prefix:
|
||||
pre_dir, pre = prefix.rsplit('/', 1)
|
||||
if isdir(join(ROOT, directory, pre_dir)):
|
||||
directory = join(directory, pre_dir)
|
||||
prefix = pre
|
||||
|
||||
completions = $(ls @(join(ROOT, directory))).splitlines()
|
||||
|
||||
display = make_display(directory)
|
||||
return {display(i) for i in completions if i.startswith(prefix)}
|
||||
if not line.startswith('passget'): return set()
|
||||
return {secret for secret in !(gopass ls --flat) if secret.startswith(prefix)}
|
||||
|
||||
completer add passget passget_completer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue