Skip to content

Commit b473a24

Browse files
author
Milan Oberkirch
committed
Add basic completion for fish
This is a subset of tadfisher#151, only implementing the most relevant completion (see tadfisher#118), i.e. completing password names.
1 parent a364d2a commit b473a24

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LIBDIR ?= $(PREFIX)/lib
55
SYSTEM_EXTENSION_DIR ?= $(LIBDIR)/password-store/extensions
66
MANDIR ?= $(PREFIX)/man
77
BASHCOMPDIR ?= /etc/bash_completion.d
8+
FISHCOMPDIR ?= $(shell pkg-config --variable completionsdir fish || echo "/usr/share/fish/vendor_completions.d/")
89

910
all:
1011
@echo "pass-$(PROG) is a shell script and does not need compilation, it can be simply executed."
@@ -20,6 +21,8 @@ install:
2021
install -m0755 $(PROG).bash "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash"
2122
install -d "$(DESTDIR)$(BASHCOMPDIR)/"
2223
install -m 644 pass-otp.bash.completion "$(DESTDIR)$(BASHCOMPDIR)/pass-otp"
24+
install -d "$(DESTDIR)$(FISHCOMPDIR)/"
25+
install -m 644 pass-otp.fish.completion "$(DESTDIR)$(FISHCOMPDIR)/pass-otp.fish"
2326
@echo
2427
@echo "pass-$(PROG) is installed succesfully"
2528
@echo

pass-otp.fish.completion

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env fish
2+
3+
source "/usr/share/fish/vendor_completions.d/pass.fish"
4+
5+
complete -c $PROG -f -n '__fish_pass_needs_command' -a otp -d 'Command: Generate an OTP code'
6+
complete -c $PROG -f -n '__fish_pass_uses_command otp' -s c -l clip -d 'Put otp code in clipboard'
7+
complete -c $PROG -f -n '__fish_pass_uses_command otp' -a "(__fish_pass_print_entries)"

0 commit comments

Comments
 (0)