From bebc075ecb76e322409950256de6793e8603f4f4 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Wed, 8 Sep 2021 20:02:30 -0400 Subject: Add completion for pass and ssh got my ksh configuration --- kshrc | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'kshrc') diff --git a/kshrc b/kshrc index 78663da..321dcab 100644 --- a/kshrc +++ b/kshrc @@ -27,9 +27,6 @@ setaliases() { alias search='grep -niRIE' alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'" alias setxkbmap-list="man xkeyboard-config" - showsshhosts() { - cat ~/.ssh/config ~/.ssh/inc/* 2>/dev/null | awk '/^[hH]ost /{$1=""; print $0}' - } # docker-getip $container_id alias docker-getip="docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'" alias xa='xargs -I{}' @@ -230,6 +227,24 @@ setperms() { find "$@" -type d -print0 | xargs -0 chmod "$dir_perms" } +showsshhosts() { + cat ~/.ssh/config ~/.ssh/inc/* 2>/dev/null | awk '/^[hH]ost /{$1=""; print $0}' +} + +showPasswordStore() { +_passDir="$1" ; shift + +find "$_passDir" -type f -iname '*.gpg' \ +| while read -r _line; do + _line="${_line##$_passDir}" + _line="${_line#/}" + _line="${_line%.gpg}" + echo "$_line" +done + +unset _passDir +} + set_title() { printf $'\033]0;'"%s"$'\007' "$1" } @@ -641,13 +656,17 @@ setsudoaliases if [ -n "$YASH_VERSION" ] ; then echo "Intentionally left blank" >/dev/null 2>&1 elif [ -n "$KSH_VERSION" ] ; then - export HISTFILE="$HOME/.ksh_history" - export HISTSIZE=10000 + HISTFILE="$HOME/.ksh_history" + HISTSIZE=10000 bind ^L=clear-screen set -o emacs #shellcheck disable=SC2155 + set -A complete_pass -- show find otp grep insert edit generate rm mv cp \ + $(showPasswordStore ~/.password-store) + set -A complete_ssh -- -L -D -A -X $(showsshhosts | awk '{print $1}') + # if you want PWD # export PS1='\u@\h \$PWD \$ ' export PS1='\u@\h\$ ' -- cgit v1.2.3