WillAbides / kongplete

MIT License
30 stars 9 forks source link

How can a repeated flag use predictions? #16

Closed shlomi-dr closed 12 months ago

shlomi-dr commented 2 years ago

For example, I have an argument that is a repeated list of strings:

var predictors = map[string]complete.Predictor{
    "string":        complete.PredictSet("test1","test2"),
}

type CLI struct {
   Repeated []string `name:"repeated" predictor:"string"`
}

...

I'd like the complete to both test1 and test2 below:

> ./cli -repeated test1,test2

At the command line, completion only works for the very first element (test1 in the example above), after adding the separator, we no longer get completions.

Is there a way to achieve that?

featheredtoast commented 12 months ago

I have a similar question/request, but for arguments,

Repeated string[] `arg="" predictor:"string"`

edit -- nevermind I'm after something different -- last position args, but it does feel related.