File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
pkg/handlers/decision_logs Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
package decision_logs //nolint // prefer standardizing name over removing _
2
2
3
3
import (
4
+ "fmt"
4
5
"os"
5
6
"os/signal"
6
7
"time"
@@ -14,11 +15,15 @@ import (
14
15
15
16
type StreamCmd struct {
16
17
PolicyName string `arg:"" help:"Name of policy to open stream for"`
17
- InstanceLabel string `arg:"" help:"Label of policy to open stream for"`
18
- Since string `optional :"" help:"time to start streaming events from in RFC3339 format"`
18
+ InstanceLabel string `arg:"" help:"Label of policy to open stream for" optional:"" `
19
+ Since string `flag :"" help:"time to start streaming events from in RFC3339 format" optional:" "`
19
20
}
20
21
21
22
func (cmd StreamCmd ) Run (c * cc.CommonCtx ) error {
23
+ if cmd .InstanceLabel == "" && cmd .PolicyName != "" {
24
+ cmd .InstanceLabel = cmd .PolicyName
25
+ }
26
+
22
27
cli , err := c .DecisionLogsClient (c .Context )
23
28
if err != nil {
24
29
return err
@@ -54,11 +59,7 @@ func (cmd StreamCmd) Run(c *cc.CommonCtx) error {
54
59
return
55
60
}
56
61
57
- errRcv = jsonx .OutputJSON (c .StdOut (), resp .Decision )
58
- if err != nil {
59
- errCh <- errRcv
60
- return
61
- }
62
+ fmt .Fprintln (c .StdOut (), jsonx .MarshalOpts (true ).Format (resp .Decision ))
62
63
}
63
64
}()
64
65
You can’t perform that action at this time.
0 commit comments