yq/yq.go

26 lines
391 B
Go
Raw Normal View History

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() {
cmd := command.New()
2022-01-27 01:07:41 +00:00
args := os.Args[1:]
_, _, err := cmd.Find(args)
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:]...))
}
if err := cmd.Execute(); err != nil {
os.Exit(1)
}
}