From d8f478e6cf5d4246ad58512769faa2a89267f06e Mon Sep 17 00:00:00 2001 From: Sergey Grebenshchikov Date: Fri, 30 Mar 2018 22:56:37 +0200 Subject: Accept x/y pair slices, interleave results of union-selection. --- cmd/jp/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd/jp/main.go') diff --git a/cmd/jp/main.go b/cmd/jp/main.go index 4f26ecb..6cc9898 100644 --- a/cmd/jp/main.go +++ b/cmd/jp/main.go @@ -97,17 +97,20 @@ func init() { var err error xPattern = jsonpath.New("x") + xPattern.AllowMissingKeys(true) err = xPattern.Parse(fmt.Sprintf("{%s}", config.X)) if err != nil { log.Fatal(err) } yPattern = jsonpath.New("y") + yPattern.AllowMissingKeys(true) err = yPattern.Parse(fmt.Sprintf("{%s}", config.Y)) if err != nil { log.Fatal(err) } - if config.XY != "" { + if config.XY != "" || (config.X == "" && config.Y == "") { xyPattern = jsonpath.New("xy") + xyPattern.AllowMissingKeys(true) err = xyPattern.Parse(fmt.Sprintf("{%s}", config.XY)) if err != nil { log.Fatal(err) -- cgit v1.2.3