Skip to content

Commit 64bcf99

Browse files
committed
Add JMESPath support
1 parent 5f7566b commit 64bcf99

File tree

6 files changed

+7
-246
lines changed

6 files changed

+7
-246
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ It is comprised of three sub-commands:
2424

2525
## Installing
2626

27-
**Go users**: Simply `go install github.com/stilvoid/please`.
27+
**Go users**: Simply `go get github.com/stilvoid/please`.
2828

2929
**Arch Linux**: There's a [please package in the AUR](https://aur4.archlinux.org/packages/please/).
3030

cmd/parse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"os"
77

88
"github.com/andrew-d/go-termutil"
9+
"github.com/jmespath/go-jmespath"
910
"github.com/pborman/getopt"
10-
"github.com/stilvoid/please/common"
1111
"github.com/stilvoid/please/formatters"
1212
"github.com/stilvoid/please/parsers"
1313
)
@@ -23,7 +23,7 @@ func parseHelp() {
2323
fmt.Println()
2424
fmt.Println("If OUTPUT TYPE is omitted, it will default to the same as the input type - effectively acting as a pretty-printer.")
2525
fmt.Println()
26-
fmt.Println("If PATH is provided, it should be given in dot-notation, e.g. orders.*.id")
26+
fmt.Println("PATH, if provided, is a JMESPath query, e.g. orders.*.id")
2727
fmt.Println()
2828
fmt.Println("Available input types:")
2929
fmt.Printf(" auto\n")
@@ -87,7 +87,7 @@ func parseCommand(args []string) {
8787

8888
// Path
8989
if getopt.NArgs() > 0 {
90-
parsed, err = common.Filter(parsed, getopt.Arg(0))
90+
parsed, err = jmespath.Search(getopt.Arg(0), parsed)
9191

9292
if err != nil {
9393
fmt.Fprintln(os.Stderr, err)

common/filter.go

Lines changed: 0 additions & 80 deletions
This file was deleted.

common/filter_test.go

Lines changed: 0 additions & 162 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.12
55
require (
66
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2
77
github.com/clbanning/x2j v0.0.0-20180326210544-5e605d46809c
8+
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
89
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3
910
golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72
1011
gopkg.in/yaml.v2 v2.2.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 h1:axBiC50cNZ
22
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2/go.mod h1:jnzFpU88PccN/tPPhCpnNU8mZphvKxYM9lLNkd8e+os=
33
github.com/clbanning/x2j v0.0.0-20180326210544-5e605d46809c h1:gZ7YRTPnL5fRduIw4unEfQWLB/DInK29N2zYza16wfQ=
44
github.com/clbanning/x2j v0.0.0-20180326210544-5e605d46809c/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
5+
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
6+
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
57
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3 h1:YtFkrqsMEj7YqpIhRteVxJxCeC3jJBieuLr0d4C4rSA=
68
github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
79
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

0 commit comments

Comments
 (0)