dotfiles/.bin/ksh-update-completions

32 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-02-22 08:31:38 +01:00
#!/bin/ksh
rm -f "${HOME}/.ksh-complete"
add() { ( printf '%s %s' "$1" "$2" | tr '\n' ' '; printf '\n') >> "${HOME}/.ksh-complete"; }
if [ -d ~/.password-store ]; then
ARGS="$(cd ~/.password-store && ls -1d */* | sed 's/\.gpg$//g;s/ /\\ /g')"
add "set -A complete_pass -- change edit insert show rm cp mv search find " "$ARGS"
2023-02-22 08:31:38 +01:00
fi
if [ -f ${HOME}/.ssh/config ]; then
add "set -A complete_ssh -- " "$(awk '/^Host .*/ { print $2 }' ${HOME}/.ssh/config)"
fi
add "set -A complete_kill_1 -- " "-9 -HUP -INFO -KILL -TERM"
add "set -A complete_ifconfig_1 -- " "$(ifconfig | grep ^[a-z] | cut -d: -f1)"
add "set -A complete_amused_1 -- " "add flush jump load monitor next pause play prev repeat restart show status stop toggle"
add "set -A complete_got_1 -- " "$(got -h 2>&1 | sed -n s/commands://p)"
ARGS="install uninstall test update-patches update-plist lib-depends-check port-lib-depends-check clean show="
add "set -A complete_make_1 -- " "$ARGS"
ARGS="reload restart stop start disable enable ls"
add "set -A complete_rcctl_1 -- " "$ARGS"
add "set -A complete_rcctl_2 -- " "$(rcctl ls all)"
add "set -A complete_got_1 -- " "$(got -h 2>&1 | sed -n s/commands://p)"
add "set -A complete_cg -- " "bitreich cufflink efnet hackint ircnet liberachat oftc robustirc uugrn"
add "set -A complete_man -- " "port-modules bsd.port.mk ports packages dpb make ffmpeg-complete mpv cabal-module cargo-module go-module gnome-module python-module qmake-module ruby-module cargo"