diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-09-08 20:02:30 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-09-08 20:02:30 -0400 |
| commit | bebc075ecb76e322409950256de6793e8603f4f4 (patch) | |
| tree | 529988cd6ced95120e4971d12eb9a79bfd4da63e | |
| parent | b5e7ba34556bf97a1bee92fd4554e8053dac6fb1 (diff) | |
| download | dotfiles-bebc075ecb76e322409950256de6793e8603f4f4.tar.gz dotfiles-bebc075ecb76e322409950256de6793e8603f4f4.tar.xz | |
Add completion for pass and ssh got my ksh configuration
| -rw-r--r-- | kshrc | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -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\$ ' |
