2015-09-26 22:15:49 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-01-19 21:42:08 +00:00
|
|
|
"os"
|
|
|
|
|
2020-10-27 05:45:16 +00:00
|
|
|
command "github.com/mikefarah/yq/v4/cmd"
|
2015-09-26 22:15:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-01-13 09:11:56 +00:00
|
|
|
cmd := command.New()
|
2022-01-27 01:07:41 +00:00
|
|
|
|
|
|
|
args := os.Args[1:]
|
|
|
|
|
|
|
|
_, _, err := cmd.Find(args)
|
2022-02-13 21:03:24 +00:00
|
|
|
if err != nil && args[0] != "__complete" {
|
2022-01-27 01:07:41 +00:00
|
|
|
// default command when nothing matches...
|
|
|
|
newArgs := []string{"eval"}
|
|
|
|
cmd.SetArgs(append(newArgs, os.Args[1:]...))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-09-22 19:58:12 +00:00
|
|
|
if err := cmd.Execute(); err != nil {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|