complete/gocomplete/complete.go

37 lines
615 B
Go
Raw Normal View History

2017-05-05 10:01:27 -05:00
package main
import (
"github.com/posener/complete"
)
var (
build = complete.Command{
Flags: complete.Flags{
2017-05-05 13:59:10 -05:00
"-o": complete.PredictFiles("*"),
"-i": complete.PredictNothing,
2017-05-05 10:01:27 -05:00
},
Args: complete.PredictFiles("**.go").Or(complete.PredictDirs("./")),
}
test = complete.Command{
Flags: complete.Flags{
2017-05-05 13:59:10 -05:00
"-run": complete.PredictAnything,
"-count": complete.PredictAnything,
},
}
gogo = complete.Command{
Sub: complete.Commands{
"build": build,
"test": test,
2017-05-05 10:01:27 -05:00
},
Flags: complete.Flags{
2017-05-05 13:59:10 -05:00
"-h": complete.PredictNothing,
},
}
)
2017-05-05 10:01:27 -05:00
func main() {
complete.New(gogo).Complete()
2017-05-05 10:01:27 -05:00
}