From 7976dfdf537947de6b30159229759438631e4aa5 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Fri, 5 Nov 2021 22:49:06 -0400 Subject: Set ASKPASS program before starting the agent. Move completion commands into their own function. --- kshrc | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'kshrc') diff --git a/kshrc b/kshrc index 67cf74a..d37807e 100644 --- a/kshrc +++ b/kshrc @@ -193,6 +193,35 @@ export CHARSET="$1"; export LANG="$1"; } +set_ksh_competion() { + if [ -z "$KSH_VERSION" ] ; then return ; fi + + if [ -r ~/.passsword-store ] ; then + + #shellcheck disable=SC2046 + set -A complete_pass -- show find otp grep \ + insert edit generate rm mv cp \ + $(showPasswordStore ~/.password-store) + + #shellcheck disable=SC2046 + [ -x "$(command -v dpw)" ] && set -A complete_dpw_1 -- \ + show copy type list ls mv cp rm edit otp fnd find insert \ + && set -A complete_dpw_2 -- $(dpw list) + + #shellcheck disable=SC2046 + set -A complete_passenv -- \ + $(showPasswordStore ~/.password-store) + + fi + + #shellcheck disable=SC2046 + set -A complete_ssh -- -L -D -A -X \ + $(showsshhosts | awk '{print $1}') + + set -A complete_setPrompt -- date time basic + +} + # Usage debugstarttls $ipaddr:$port debugstarttls() { openssl s_client -starttls smtp -crlf -connect "$1" "$2" @@ -335,6 +364,10 @@ timestamp() { } checkSSHAgent() { + if [ "$1" = "-k" ] ; then + pkill -9 ssh-agent + fi + ssh_agent_conf="$HOME/.ssh/agent" if [ -e "$ssh_agent_conf" ] ; then #shellcheck disable=SC1090 @@ -695,9 +728,9 @@ setaliases setsudoaliases if [ -n "$DISPLAY" ] ; then - checkSSHAgent [ -x "$(command -v dmenu_askpass)" ] && \ export SSH_ASKPASS=dmenu_askpass + checkSSHAgent fi @@ -711,14 +744,7 @@ elif [ -n "$KSH_VERSION" ] ; then bind ^L=clear-screen set -o emacs - [ -r ~/.password-store ] && set -A complete_pass -- show find otp grep \ - insert edit generate rm mv cp \ - $(showPasswordStore ~/.password-store) - [ -r ~/.password-store ] && set -A complete_passenv -- \ - $(showPasswordStore ~/.password-store) - [ -r ~/.ssh/config ] && set -A complete_ssh -- -L -D -A -X \ - $(showsshhosts | awk '{print $1}') - set -A complete_setPrompt -- date time basic + set_ksh_competion # if you want PWD # export PS1='`nzret`\u@\h \$PWD \$ ' -- cgit v1.2.3