Update 2024-12-22 09:05 OpenBSD/amd64-t14
This commit is contained in:
125
.bin/update-ksh-completions
Executable file
125
.bin/update-ksh-completions
Executable file
@@ -0,0 +1,125 @@
|
||||
#!/bin/ksh
|
||||
|
||||
FILE="$HOME/.kshrc.autocomplete"
|
||||
|
||||
rm -f "${FILE}"
|
||||
|
||||
add() {
|
||||
echo "$1 $2" | xargs >> "${FILE}";
|
||||
}
|
||||
|
||||
#
|
||||
# PASSWORD STORE
|
||||
#
|
||||
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"
|
||||
fi
|
||||
|
||||
#
|
||||
# SSH HOSTS
|
||||
#
|
||||
if [ -f ~/.ssh/config ]
|
||||
then
|
||||
ARGS="$(awk '/^Host .*/ { print $2 }' ~/.ssh/config)"
|
||||
add "set -A complete_ssh -- " "$ARGS"
|
||||
add "set -A complete_scp -- " "$ARGS"
|
||||
fi
|
||||
|
||||
#
|
||||
# KILL
|
||||
#
|
||||
add "set -A complete_kill_1 -- " "-9 -HUP -INFO -KILL -TERM"
|
||||
|
||||
#
|
||||
# IFCONFIG
|
||||
#
|
||||
add "set -A complete_ifconfig_1 -- " "$(ifconfig | grep ^[a-z] | cut -d: -f1)"
|
||||
|
||||
#
|
||||
# manpages
|
||||
#
|
||||
S1="$(man -s 1 -k any= | cut -d"(" -f1 | tr -d "," | xargs)"
|
||||
S2="$(man -s 2 -k any= | cut -d"(" -f1 | tr -d "," | xargs)"
|
||||
S3="$(man -s 3 -k any= | cut -d"(" -f1 | tr -d "," | xargs)"
|
||||
S4="$(man -s 4 -k any= | cut -d"(" -f1 | tr -d "," | xargs)"
|
||||
S5="$(man -s 5 -k any= | cut -d"(" -f1 | tr -d "," | xargs)"
|
||||
S8="$(man -s 8 -k any= | cut -d"(" -f1 | tr -d "," | xargs)"
|
||||
add "set -A complete_man_1 -- " "$S1 $S5 $S8"
|
||||
|
||||
#
|
||||
# AMUSED
|
||||
#
|
||||
ARGS="add flush jump load monitor next pause play prev repeat restart show status stop toggle"
|
||||
add "set -A complete_amused_1 -- " "$ARGS"
|
||||
|
||||
#
|
||||
# GOT
|
||||
#
|
||||
if [ -f /usr/local/bin/got ]
|
||||
then
|
||||
ARGS="$(got -h 2>&1 | sed -n s/commands://p)"
|
||||
add "set -A complete_got_1 -- " "$ARGS"
|
||||
fi
|
||||
|
||||
ARGS="all all-dir-depends all-lib-depends-args build build-depends-list \
|
||||
build-dir-depends check-register check-register-all checkpatch \
|
||||
checksum clean clean-depends clean=all clean=build clean=bulk \
|
||||
clean=depends clean=dist clean=fake clean=flavors clean=install \
|
||||
clean=package clean=packages clean=plist clean=sub clean=test \
|
||||
clean=work configure distclean distpatch do-build do-configure \
|
||||
do-distpatch do-extract do-fake do-gen do-install do-patch \
|
||||
do-test dump-vars extract fake fake-wantlib-args fetch fetch-all \
|
||||
fix-permissions full-all-depends full-build-depends full-run-depends \
|
||||
full-test-depends gen generate-readmes install install-all \
|
||||
install-depends lib-depends-args lib-depends-check lib-depends-list \
|
||||
license-check lock makesum no-lib-depends-args no-wantlib-args package \
|
||||
patch peek-ftp pkglocatedb port-lib-depends-check port-wantlib-args \
|
||||
post-build post-configure post-distpatch post-extract post-fake \
|
||||
post-gen post-install post-patch post-test pre-build pre-configure \
|
||||
pre-distpatch pre-extract pre-fake pre-gen pre-install pre-patch \
|
||||
pre-test prepare print-build-depends print-package-args print-plist \
|
||||
print-plist-all print-plist-all-libs print-plist-all-with-depends \
|
||||
print-plist-contents print-plist-libs print-plist-libs-with-depends \
|
||||
print-plist-with-depends print-run-depends print-update-signature \
|
||||
rebuild regen reinstall repackage reprepare retest run-depends-args \
|
||||
run-depends-list run-dir-depends show-debug-info show-fake-size \
|
||||
show-indexed show-list show-prepare-results show-prepare-test-results \
|
||||
show-required-by show-run-depends show-size subpackage test test-depends \
|
||||
test-depends-list test-dir-depends unlock update update-patches \
|
||||
update-plist update-update-or-install update-update-or-install-all \
|
||||
verbose-show wantlib-args MODGO_VERSION=latest"
|
||||
add "set -A complete_make_1 -- " "$ARGS"
|
||||
add "set -A complete_make_2 -- " "modgo-gen-modules"
|
||||
|
||||
if [ -f /usr/sbin/rcctl ]
|
||||
then
|
||||
ARGS="reload restart stop start disable enable ls"
|
||||
add "set -A complete_rcctl_2 -- " "$ARGS"
|
||||
add "set -A complete_rcctl_2 -- " "$(rcctl ls all)"
|
||||
fi
|
||||
|
||||
#
|
||||
# VIDEO
|
||||
#
|
||||
if [ -d ~/ytdl ]
|
||||
then
|
||||
add "set -A complete_ytdl_1 -- " "$( find $HOME/ytdl -maxdepth 2 -type d | sed "s,$HOME/ytdl/,,g" | grep -v $HOME)"
|
||||
fi
|
||||
|
||||
#
|
||||
# CATGIRL
|
||||
#
|
||||
if [ -d ~/.config/catgirl ]
|
||||
then
|
||||
add "set -A complete_catgirl -- " "$(cd ~/.config/catgirl && ls *)"
|
||||
fi
|
||||
|
||||
#
|
||||
# MANPAGES
|
||||
#
|
||||
ARGS="port-modules bsd.port.mk ports packages dpb make ffmpeg-all \
|
||||
mpv cabal-module cargo-module go-module gnome-module python-module \
|
||||
qmake-module ruby-module cargo"
|
||||
add "set -A complete_man -- " "$ARGS"
|
||||
Reference in New Issue
Block a user