Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 78b337a

Browse files
committedOct 5, 2021
Added silent mode for monitor
1 parent 64434e5 commit 78b337a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed
 

‎cli/monitor/monitor.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var tr = i18n.Tr
3939

4040
var portArgs arguments.Port
4141
var describe bool
42+
var silent bool
4243

4344
// NewCommand created a new `monitor` command
4445
func NewCommand() *cobra.Command {
@@ -53,13 +54,18 @@ func NewCommand() *cobra.Command {
5354
}
5455
portArgs.AddToCommand(cmd)
5556
cmd.Flags().BoolVar(&describe, "describe", false, tr("Show all the settings of the communication port."))
57+
cmd.Flags().BoolVarP(&silent, "silent", "s", false, tr("Run in silent mode, show only monitor input and output."))
5658
cmd.MarkFlagRequired("port")
5759
return cmd
5860
}
5961

6062
func runMonitorCmd(cmd *cobra.Command, args []string) {
6163
instance := instance.CreateAndInit()
6264

65+
if !configuration.HasConsole {
66+
silent = true
67+
}
68+
6369
port, err := portArgs.GetPort(instance, nil)
6470
if err != nil {
6571
feedback.Error(err)
@@ -114,7 +120,9 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
114120
cancel()
115121
}()
116122

117-
feedback.Print(tr("Connected to %s! Press CTRL-C to exit.", port.String()))
123+
if !silent {
124+
feedback.Print(tr("Connected to %s! Press CTRL-C to exit.", port.String()))
125+
}
118126

119127
// Wait for port closed
120128
<-ctx.Done()

0 commit comments

Comments
 (0)
Please sign in to comment.