It is easy to add autocompletion to commands in ksh, however they are limited because they have to be evaluated when the shell is starting.
In the following example, we can parse the file
~/.ssh/known_hoststo get hostnames and use this list to set completion for some commands:
HOSTS_LIST=$(awk '{split($1,a,","); print a[1]}' ~/.ssh/known_hosts) set -A complete_ssh -- $HOSTS_LIST set -A complete_ping -- $HOSTS_LIST set -A complete_sndioctl_1 -- $(sndioctl | cut -d= -f 1)
In this other example, we add different completion depending on the parameter position
set -A complete_rclone_1 -- ncdu ls copy sync set -A complete_rclone_2 -- $(rclone listremotes)Adding completion is easy but this will be evaluated at runtime, so you should avoid time consuming evaluations and some commands like scp or git can't receive much useful completion.
More information can be found about this feature in ksh man page.