mirror of
https://gitee.com/mirrors_adrian-thurston/yq.git
synced 2026-01-15 07:53:35 +08:00
It seems it should be possible to use a replace in go mod to avoid rewriting, but I couldn't make it work when running go install. I get the feeling there is some magic thing to do that I wasn't getting.
26 lines
397 B
Go
26 lines
397 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
command "github.com/adrian-thurston/yq/v4/cmd"
|
|
)
|
|
|
|
func main() {
|
|
cmd := command.New()
|
|
|
|
args := os.Args[1:]
|
|
|
|
_, _, err := cmd.Find(args)
|
|
if err != nil && args[0] != "__complete" {
|
|
// default command when nothing matches...
|
|
newArgs := []string{"eval"}
|
|
cmd.SetArgs(append(newArgs, os.Args[1:]...))
|
|
|
|
}
|
|
|
|
if err := cmd.Execute(); err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|