File tree 4 files changed +7
-2
lines changed
4 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 8
8
"github.com/fatih/color"
9
9
"github.com/knqyf263/pet/config"
10
10
"github.com/spf13/cobra"
11
+ "gopkg.in/alessio/shellescape.v1"
11
12
)
12
13
13
14
// execCmd represents the exec command
@@ -23,7 +24,7 @@ func execute(cmd *cobra.Command, args []string) (err error) {
23
24
24
25
var options []string
25
26
if flag .Query != "" {
26
- options = append (options , fmt .Sprintf ("--query %s" , flag .Query ))
27
+ options = append (options , fmt .Sprintf ("--query %s" , shellescape . Quote ( flag .Query ) ))
27
28
}
28
29
29
30
commands , err := filter (options )
Original file line number Diff line number Diff line change 7
7
"github.com/knqyf263/pet/config"
8
8
"github.com/spf13/cobra"
9
9
"golang.org/x/crypto/ssh/terminal"
10
+ "gopkg.in/alessio/shellescape.v1"
10
11
)
11
12
12
13
var delimiter string
@@ -24,7 +25,7 @@ func search(cmd *cobra.Command, args []string) (err error) {
24
25
25
26
var options []string
26
27
if flag .Query != "" {
27
- options = append (options , fmt .Sprintf ("--query %s" , flag .Query ))
28
+ options = append (options , fmt .Sprintf ("--query %s" , shellescape . Quote ( flag .Query ) ))
28
29
}
29
30
commands , err := filter (options )
30
31
if err != nil {
Original file line number Diff line number Diff line change @@ -23,4 +23,5 @@ require (
23
23
golang.org/x/oauth2 v0.0.0-20180603041954-1e0a3fa8ba9a
24
24
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect
25
25
google.golang.org/appengine v1.0.0 // indirect
26
+ gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 // indirect
26
27
)
Original file line number Diff line number Diff line change @@ -44,3 +44,5 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193
44
44
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
45
45
google.golang.org/appengine v1.0.0 h1:dN4LljjBKVChsv0XCSI+zbyzdqrkEwX5LQFUMRSGqOc =
46
46
google.golang.org/appengine v1.0.0 /go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM =
47
+ gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 h1:8ajkpB4hXVftY5ko905id+dOnmorcS2CHNxxHLLDcFM =
48
+ gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 /go.mod h1:IfMagxm39Ys4ybJrDb7W3Ob8RwxftP0Yy+or/NVz1O8 =
You can’t perform that action at this time.
0 commit comments