File tree Expand file tree Collapse file tree 4 files changed +19
-14
lines changed Expand file tree Collapse file tree 4 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ require (
24
24
github.com/spf13/viper v1.14.0
25
25
github.com/stretchr/testify v1.8.1
26
26
github.com/zalando/go-keyring v0.2.1
27
+ golang.org/x/term v0.8.0
27
28
)
28
29
29
30
require (
@@ -64,8 +65,7 @@ require (
64
65
github.com/yuin/goldmark v1.5.3 // indirect
65
66
github.com/yuin/goldmark-emoji v1.0.1 // indirect
66
67
golang.org/x/net v0.7.0 // indirect
67
- golang.org/x/sys v0.5.0 // indirect
68
- golang.org/x/term v0.5.0 // indirect
68
+ golang.org/x/sys v0.8.0 // indirect
69
69
golang.org/x/text v0.7.0 // indirect
70
70
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
71
71
gopkg.in/ini.v1 v1.67.0 // indirect
Original file line number Diff line number Diff line change @@ -425,14 +425,14 @@ golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBc
425
425
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
426
426
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
427
427
golang.org/x/sys v0.0.0-20220908164124-27713097b956 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
428
- golang.org/x/sys v0.5 .0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU =
429
- golang.org/x/sys v0.5 .0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
428
+ golang.org/x/sys v0.8 .0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU =
429
+ golang.org/x/sys v0.8 .0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
430
430
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 /go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo =
431
431
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf /go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo =
432
432
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 /go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY =
433
433
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 /go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8 =
434
- golang.org/x/term v0.5 .0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY =
435
- golang.org/x/term v0.5 .0 /go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k =
434
+ golang.org/x/term v0.8 .0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols =
435
+ golang.org/x/term v0.8 .0 /go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo =
436
436
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c /go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ =
437
437
golang.org/x/text v0.3.0 /go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ =
438
438
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 /go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ =
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ $ jira issue edit ISSUE-1 -s"New Bug" -yHigh -lbug -lurgent -CBackend -b"Bug des
28
28
# Use --no-input option to disable interactive prompt
29
29
$ jira issue edit ISSUE-1 -s"New updated summary" --no-input
30
30
31
+ # Use pipe to read the description body directly from standard input
32
+ $ echo "Description from stdin" | jira issue edit ISSUE-1 -s"New updated summary" --no-input
33
+
31
34
# Use minus (-) to remove label, component or fixVersion
32
35
$ jira issue edit ISSUE-1 --label -urgent --component -BE --fix-version -v1.0`
33
36
)
@@ -96,6 +99,14 @@ func edit(cmd *cobra.Command, args []string) {
96
99
getAnswers (params , issue )
97
100
}
98
101
102
+ // Use stdin only if nothing is passed to --body
103
+ if params .body == "" && cmdutil .StdinHasData () {
104
+ b , err := cmdutil .ReadFile ("-" )
105
+ if err != nil {
106
+ cmdutil .Failed ("Error: %s" , err )
107
+ }
108
+ params .body = string (b )
109
+ }
99
110
// Keep body as is if there were no changes.
100
111
if params .body != "" && params .body == originalBody {
101
112
params .body = ""
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
"github.com/fatih/color"
13
13
"github.com/mitchellh/go-homedir"
14
14
"github.com/spf13/viper"
15
+ "golang.org/x/term"
15
16
16
17
"github.com/ankitpokhrel/jira-cli/pkg/browser"
17
18
"github.com/ankitpokhrel/jira-cli/pkg/jira"
@@ -129,14 +130,7 @@ func GetConfigHome() (string, error) {
129
130
130
131
// StdinHasData checks if standard input has any data to be processed.
131
132
func StdinHasData () bool {
132
- fi , err := os .Stdin .Stat ()
133
- if err != nil {
134
- return false
135
- }
136
- if fi .Mode ()& os .ModeNamedPipe == 0 {
137
- return false
138
- }
139
- return true
133
+ return ! term .IsTerminal (int (os .Stdin .Fd ()))
140
134
}
141
135
142
136
// ReadFile reads contents of the given file.
You can’t perform that action at this time.
0 commit comments