2017-05-05 10:01:27 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/posener/complete"
|
|
|
|
)
|
|
|
|
|
2017-05-05 10:06:31 -05:00
|
|
|
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
|
|
|
},
|
2017-05-05 15:07:18 -05:00
|
|
|
Args: complete.PredictFiles("**.go").Or(complete.PredictDirs("./")),
|
2017-05-05 10:06:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
test = complete.Command{
|
|
|
|
Flags: complete.Flags{
|
2017-05-05 13:59:10 -05:00
|
|
|
"-run": complete.PredictAnything,
|
|
|
|
"-count": complete.PredictAnything,
|
2017-05-05 10:06:31 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
gogo = complete.Command{
|
|
|
|
Sub: complete.Commands{
|
|
|
|
"build": build,
|
|
|
|
"test": test,
|
2017-05-05 10:01:27 -05:00
|
|
|
},
|
2017-05-05 10:06:31 -05:00
|
|
|
Flags: complete.Flags{
|
2017-05-05 13:59:10 -05:00
|
|
|
"-h": complete.PredictNothing,
|
2017-05-05 10:06:31 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
2017-05-05 10:01:27 -05:00
|
|
|
|
|
|
|
func main() {
|
2017-05-05 10:06:31 -05:00
|
|
|
complete.New(gogo).Complete()
|
2017-05-05 10:01:27 -05:00
|
|
|
}
|