Skip to content

Commit 531e06b

Browse files
committed
Applied review suggestions
* rename --silent to --quiet * removed useless 'settings' variable
1 parent 21f55b9 commit 531e06b

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

Diff for: cli/monitor/monitor.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var tr = i18n.Tr
4242
var portArgs arguments.Port
4343
var describe bool
4444
var configs []string
45-
var silent bool
45+
var quiet bool
4646

4747
// NewCommand created a new `monitor` command
4848
func NewCommand() *cobra.Command {
@@ -58,7 +58,7 @@ func NewCommand() *cobra.Command {
5858
portArgs.AddToCommand(cmd)
5959
cmd.Flags().BoolVar(&describe, "describe", false, tr("Show all the settings of the communication port."))
6060
cmd.Flags().StringSliceVarP(&configs, "config", "c", []string{}, tr("Configuration of the port."))
61-
cmd.Flags().BoolVarP(&silent, "silent", "s", false, tr("Run in silent mode, show only monitor input and output."))
61+
cmd.Flags().BoolVarP(&quiet, "quiet", "q", false, tr("Run in silent mode, show only monitor input and output."))
6262
cmd.MarkFlagRequired("port")
6363
return cmd
6464
}
@@ -67,7 +67,7 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
6767
instance := instance.CreateAndInit()
6868

6969
if !configuration.HasConsole {
70-
silent = true
70+
quiet = true
7171
}
7272

7373
port, err := portArgs.GetPort(instance, nil)
@@ -108,7 +108,6 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
108108
feedback.Error(err)
109109
os.Exit(errorcodes.ErrGeneric)
110110
}
111-
settings := resp.GetSettings()
112111
for _, config := range configs {
113112
split := strings.SplitN(config, "=", 2)
114113
k := ""
@@ -119,7 +118,7 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
119118
}
120119

121120
var setting *rpc.MonitorPortSettingDescriptor
122-
for _, s := range settings {
121+
for _, s := range resp.GetSettings() {
123122
if k == "" {
124123
if contains(s.EnumValues, v) {
125124
setting = s
@@ -144,7 +143,7 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
144143
SettingId: setting.SettingId,
145144
Value: v,
146145
})
147-
if !silent {
146+
if !quiet {
148147
feedback.Print(fmt.Sprintf("Set %s to %s", setting.SettingId, v))
149148
}
150149
}
@@ -177,7 +176,7 @@ func runMonitorCmd(cmd *cobra.Command, args []string) {
177176
cancel()
178177
}()
179178

180-
if !silent {
179+
if !quiet {
181180
feedback.Print(tr("Connected to %s! Press CTRL-C to exit.", port.String()))
182181
}
183182

Diff for: i18n/data/en.po

+9-9
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ msgstr "Configuring platform."
427427
msgid "Connected"
428428
msgstr "Connected"
429429

430-
#: cli/monitor/monitor.go:181
430+
#: cli/monitor/monitor.go:180
431431
msgid "Connected to %s! Press CTRL-C to exit."
432432
msgstr "Connected to %s! Press CTRL-C to exit."
433433

@@ -504,7 +504,7 @@ msgstr "Debugging not supported for board %s"
504504
msgid "Debugging supported:"
505505
msgstr "Debugging supported:"
506506

507-
#: cli/monitor/monitor.go:199
507+
#: cli/monitor/monitor.go:198
508508
msgid "Default"
509509
msgstr "Default"
510510

@@ -1138,7 +1138,7 @@ msgstr "Global variables use {0} bytes of dynamic memory."
11381138

11391139
#: cli/core/list.go:84
11401140
#: cli/core/search.go:114
1141-
#: cli/monitor/monitor.go:199
1141+
#: cli/monitor/monitor.go:198
11421142
#: cli/outdated/outdated.go:62
11431143
msgid "ID"
11441144
msgstr "ID"
@@ -1727,8 +1727,8 @@ msgstr "Platform size (bytes):"
17271727
msgid "Port"
17281728
msgstr "Port"
17291729

1730-
#: cli/monitor/monitor.go:168
1731-
#: cli/monitor/monitor.go:175
1730+
#: cli/monitor/monitor.go:167
1731+
#: cli/monitor/monitor.go:174
17321732
msgid "Port closed:"
17331733
msgstr "Port closed:"
17341734

@@ -1869,7 +1869,7 @@ msgstr "Sets a setting value."
18691869
msgid "Sets where to save the configuration file."
18701870
msgstr "Sets where to save the configuration file."
18711871

1872-
#: cli/monitor/monitor.go:199
1872+
#: cli/monitor/monitor.go:198
18731873
msgid "Setting"
18741874
msgstr "Setting"
18751875

@@ -2344,7 +2344,7 @@ msgstr "VERSION"
23442344
msgid "VERSION_NUMBER"
23452345
msgstr "VERSION_NUMBER"
23462346

2347-
#: cli/monitor/monitor.go:199
2347+
#: cli/monitor/monitor.go:198
23482348
msgid "Values"
23492349
msgstr "Values"
23502350

@@ -2851,11 +2851,11 @@ msgstr "invalid platform archive size: %s"
28512851
msgid "invalid pluggable monitor reference: %s"
28522852
msgstr "invalid pluggable monitor reference: %s"
28532853

2854-
#: cli/monitor/monitor.go:131
2854+
#: cli/monitor/monitor.go:130
28552855
msgid "invalid port configuration value for %s: %s"
28562856
msgstr "invalid port configuration value for %s: %s"
28572857

2858-
#: cli/monitor/monitor.go:140
2858+
#: cli/monitor/monitor.go:139
28592859
msgid "invalid port configuration: %s"
28602860
msgstr "invalid port configuration: %s"
28612861

Diff for: i18n/rice-box.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)