chzyer / readline

Readline is a pure go(golang) implementation for GNU-Readline kind library
MIT License
2.08k stars 275 forks source link

Dynamic autocomplete for multiple args #139

Closed rohityadavcloud closed 5 years ago

rohityadavcloud commented 6 years ago

I've a API/command I'm trying to support, for example:

(local) 🐵 > list users 
account=      domainid=     id=           keyword=      page=         state=        
accounttype=  filter=       isrecursive=  listall=      pagesize=     username=  

However, this can take multiple options such as id= and state= etc. However, I would also like to provide auto-completion for the args, for example when user type tab-tab on id=, this might require calling a HTTP api to get args/params for this for example one, two, three. However, when id=value is completed the dynamic auto-completion method fails to show the returned []string.

chzyer commented 6 years ago

It sounds great ~

rohityadavcloud commented 6 years ago

@chzyer thanks, I was expecting some docs on writing our own completion. Can you help?

rohityadavcloud commented 5 years ago

Closing, figured out a way though it would be great to have a high level method/function instead; https://github.com/apache/cloudstack-cloudmonkey/blob/master/cli/completer.go