mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
4b2b47af48
4ec533b
introduced a bug which causes the 'hidden' cli parameter
`__complete` to be ignored.
Add a check for this parameter, so that it can pass to `cobra`
Signed-off-by: Tom Whitwell <tom@whi.tw>
26 lines
391 B
Go
26 lines
391 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
command "github.com/mikefarah/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)
|
|
}
|
|
}
|