@@ -109,6 +109,7 @@ type argOption struct {
109109}
110110
111111func buildArgOptions (response map [string ]interface {}, hasID bool ) []argOption {
112+ config .Debug ("--------------------Building argument options from response:" , response )
112113 argOptions := []argOption {}
113114 for _ , v := range response {
114115 switch obj := v .(type ) {
@@ -338,6 +339,7 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int)
338339 // Auto-complete API arg
339340 splitLine := strings .Split (string (line ), " " )
340341 line = trimSpaceLeft ([]rune (splitLine [len (splitLine )- 1 ]))
342+ config .Debug ("~~~~~~~~~~~~~~~~Line after verb and noun auto-complete: " , string (line ))
341343 for _ , arg := range apiFound .Args {
342344 search := arg .Name
343345 if ! hasPrefix (line , []rune (search )) {
@@ -410,7 +412,7 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int)
410412 return argOptions [i ].Value < argOptions [j ].Value
411413 })
412414 for _ , item := range argOptions {
413- if strings .HasPrefix (item .Value , argInput ) {
415+ if strings .HasPrefix (item .Value , argInput ) || ( len ( item . Detail ) > 0 && strings . HasPrefix ( item . Detail , argInput )) {
414416 filteredOptions = append (filteredOptions , item )
415417 }
416418 }
@@ -421,12 +423,14 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int)
421423 }
422424 for _ , item := range filteredOptions {
423425 option := item .Value + " "
424- if len (filteredOptions ) > 1 && len (item .Detail ) > 0 {
426+ if len (filteredOptions ) > 0 && len (item .Detail ) > 0 {
425427 option += fmt .Sprintf ("(%v)" , item .Detail )
426428 }
427429 if strings .HasPrefix (option , argInput ) {
428430 options = append (options , []rune (option [len (argInput ):]))
429431 offset = len (argInput )
432+ } else if len (item .Detail ) > 0 && strings .HasPrefix (item .Detail , argInput ) {
433+ options = append (options , []rune (option ))
430434 }
431435 }
432436 return
0 commit comments