Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic completion for fish #191

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ LIBDIR ?= $(PREFIX)/lib
SYSTEM_EXTENSION_DIR ?= $(LIBDIR)/password-store/extensions
MANDIR ?= $(PREFIX)/man
BASHCOMPDIR ?= /etc/bash_completion.d
FISHCOMPDIR ?= $(shell pkg-config --variable completionsdir fish || echo "/usr/share/fish/vendor_completions.d/")

all:
@echo "pass-$(PROG) is a shell script and does not need compilation, it can be simply executed."
Expand All @@ -20,6 +21,8 @@ install:
install -m0755 $(PROG).bash "$(DESTDIR)$(SYSTEM_EXTENSION_DIR)/$(PROG).bash"
install -d "$(DESTDIR)$(BASHCOMPDIR)/"
install -m 644 pass-otp.bash.completion "$(DESTDIR)$(BASHCOMPDIR)/pass-otp"
install -d "$(DESTDIR)$(FISHCOMPDIR)/"
install -m 644 pass-otp.fish.completion "$(DESTDIR)$(FISHCOMPDIR)/pass-otp.fish"
@echo
@echo "pass-$(PROG) is installed succesfully"
@echo
Expand Down
7 changes: 7 additions & 0 deletions pass-otp.fish.completion
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env fish

source "/usr/share/fish/vendor_completions.d/pass.fish"

complete -c pass -f -n '__fish_pass_needs_command' -a otp -d 'Command: Generate an OTP code'
complete -c pass -f -n '__fish_pass_uses_command otp' -s c -l clip -d 'Put otp code in clipboard'
complete -c pass -f -n '__fish_pass_uses_command otp' -a "(__fish_pass_print_entries)"