dotfiles/.bin/ksh-update-completions

34 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-02-22 08:31:38 +01:00
#!/bin/ksh
rm -f "${HOME}/.ksh/complete.ksh"
2023-02-22 08:31:38 +01:00
add() { ( printf '%s %s' "$1" "$2" | tr '\n' ' '; printf '\n') >> "${HOME}/.ksh/complete.ksh"; }
2023-02-22 08:31:38 +01:00
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)"
add "set -A complete_make_1 -- " "$(sh ~/.ksh/complete.portvars)"
2023-02-22 08:31:38 +01:00
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_xdl_1 -- " "$(cd ~/x && ls -d *)"
add "set -A complete_ytdl_1 -- " "$(cd ~/Videos/YouTube && ls -d *)"
2023-02-22 08:31:38 +01:00
add "set -A complete_catgirl -- " "$(cd ~/.config/catgirl && ls *)"
2023-02-22 08:31:38 +01:00
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"