DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th April 2020
blodorn blodorn is offline
New User
 
Join Date: Apr 2020
Posts: 1
Default ksh completion conditionals

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.

Code:
rcctl ls
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to enable file/command completion for ksh93? TerryP General software and network 1 31st August 2008 08:23 AM


All times are GMT. The time now is 08:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick