From d357b591c9c41c11aada568b234613d45faa26b1 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 16 Mar 2022 00:16:55 -0500 Subject: [PATCH] completions --- common/bin/pass-otp | 6 ------ common/fish/config.fish | 23 +++++++++++++++++++++++ common/fish/pass-otp-completions.fish | 4 ++++ 3 files changed, 27 insertions(+), 6 deletions(-) delete mode 100755 common/bin/pass-otp create mode 100644 common/fish/pass-otp-completions.fish diff --git a/common/bin/pass-otp b/common/bin/pass-otp deleted file mode 100755 index f5e81af..0000000 --- a/common/bin/pass-otp +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -echo 'This script is deprecated. Install and use the pass-otp extension. - yay -S pass-otp - pass otp $args' -exit 1 diff --git a/common/fish/config.fish b/common/fish/config.fish index 38304c8..a9f764c 100755 --- a/common/fish/config.fish +++ b/common/fish/config.fish @@ -19,4 +19,27 @@ else if test -f /opt/asdf-vm/asdf.fish source /opt/asdf-vm/asdf.fish end +if test -f /usr/share/password-store/extensions/otp.bash + source $FISH_PATH/pass-otp-completions.fish +end + +if test -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + set nix_profiles /nix/var/nix/profiles/default $HOME/.nix-profile + set --export --universal NIX_PROFILES "$nix_profiles" + + if set -q NIX_SSL_CERT_FILE + : + elif test -e /etc/ssl/certs/ca-certificates.crt + set --export --universal NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt + else + for p in (string split $NIX_PROFILES) + test -e $p/etc/ssl/certs/ca-bundle.crt && \ + set --export --universal NIX_SSL_CERT_FILE=$p/etc/ssl/certs/ca-bundle.crt + end + end + + set --prepend --export --global fish_user_paths $HOME/.nix-profile/bin /nix/var/nix/profiles/default/bin +end + + test $PWD = $HOME && begin; cd $NICE_HOME || cd; end diff --git a/common/fish/pass-otp-completions.fish b/common/fish/pass-otp-completions.fish new file mode 100644 index 0000000..933868b --- /dev/null +++ b/common/fish/pass-otp-completions.fish @@ -0,0 +1,4 @@ +#!/usr/bin/env fish +complete -c pass -f -n '__fish_pass_needs_command' -a otp -d 'Command: show TOTP code' +complete -c pass -f -n '__fish_pass_uses_command otp' -s c -l clip -d 'Put TOTP code in clipboard' +complete -c pass -f -n '__fish_pass_uses_command otp' -a "(__fish_pass_print_entries)"