Is it possible to have conditional logic in ksh tab completions?
For instance rcctl
Code:
if [ -x /usr/sbin/rcctl ]; then
SVC_LIST=$(rcctl ls all)
set -A complete_rcctl_1 -- get getdef set check reload restart start stop disable enable order ls
set -A complete_rcctl_2 -- $SVC_LIST
fi
This works so-so. I can rcctl <tab> and it lists what I say, and if I pick one and tab it lists the scvs which list it complies when the file is sourced.
I want to be be completed by
Code:
all failed off on started stopped
Is there any way to get rcctl to use one array of complete_rcctl_2 when complete_rcctl_1 is a specific group of commands, and another array of rcctl_2 when rcctl_1 is ls?
Is there some way to integrate conditional logic to the completes?
I looked at the source code but I am just starting to learn C.