Skip to content

Commit e8af622

Browse files
Run task fmt
1 parent f85b5f8 commit e8af622

File tree

1 file changed

+67
-67
lines changed

1 file changed

+67
-67
lines changed
Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
// This file is part of arduino-flasher-cli.
2-
//
3-
// Copyright 2025 ARDUINO SA (http://www.arduino.cc/)
4-
//
5-
// This software is released under the GNU General Public License version 3,
6-
// which covers the main part of arduino-flasher-cli.
7-
// The terms of this license can be found at:
8-
// https://www.gnu.org/licenses/gpl-3.0.en.html
9-
//
10-
// You can be released from the requirements of the above licenses by purchasing
11-
// a commercial license. Buying such a license is mandatory if you want to
12-
// modify or otherwise use the software for commercial activities involving the
13-
// Arduino software without disclosing the source code of your own applications.
14-
// To purchase a commercial license, send an email to license@arduino.cc.
15-
16-
package version
17-
18-
import (
19-
"fmt"
20-
21-
"github.com/fatih/color"
22-
"github.com/spf13/cobra"
23-
24-
"github.com/arduino/arduino-flasher-cli/cmd/feedback"
25-
"github.com/arduino/arduino-flasher-cli/cmd/i18n"
26-
)
27-
28-
func NewVersionCmd(version string) *cobra.Command {
29-
cmd := &cobra.Command{
30-
Use: "version",
31-
Short: "Print the version number of Arduino Flasher CLI",
32-
Run: func(cmd *cobra.Command, args []string) {
33-
feedback.PrintResult(versionResult{
34-
Name: "Arduino Flasher CLI",
35-
Version: version,
36-
})
37-
38-
latest, err := checkForUpdates(version)
39-
if err != nil {
40-
feedback.Warning(color.YellowString("\n\nFailed to check for updates: "+err.Error()) + "\n")
41-
}
42-
if latest != "" {
43-
msg := fmt.Sprintf("\n\n%s %s → %s\n%s",
44-
color.YellowString(i18n.Tr("A new release of Arduino Flasher CLI is available:")),
45-
color.CyanString(version),
46-
color.CyanString(latest),
47-
color.YellowString("https://www.arduino.cc/en/software/#flasher-tool"))
48-
feedback.Warning(msg)
49-
}
50-
},
51-
}
52-
return cmd
53-
}
54-
55-
type versionResult struct {
56-
Name string `json:"name"`
57-
Version string `json:"version"`
58-
}
59-
60-
func (r versionResult) String() string {
61-
resultMessage := fmt.Sprintf("Arduino Flasher CLI version %s", r.Version)
62-
return resultMessage
63-
}
64-
65-
func (r versionResult) Data() interface{} {
66-
return r
67-
}
1+
// This file is part of arduino-flasher-cli.
2+
//
3+
// Copyright 2025 ARDUINO SA (http://www.arduino.cc/)
4+
//
5+
// This software is released under the GNU General Public License version 3,
6+
// which covers the main part of arduino-flasher-cli.
7+
// The terms of this license can be found at:
8+
// https://www.gnu.org/licenses/gpl-3.0.en.html
9+
//
10+
// You can be released from the requirements of the above licenses by purchasing
11+
// a commercial license. Buying such a license is mandatory if you want to
12+
// modify or otherwise use the software for commercial activities involving the
13+
// Arduino software without disclosing the source code of your own applications.
14+
// To purchase a commercial license, send an email to license@arduino.cc.
15+
16+
package version
17+
18+
import (
19+
"fmt"
20+
21+
"github.com/fatih/color"
22+
"github.com/spf13/cobra"
23+
24+
"github.com/arduino/arduino-flasher-cli/cmd/feedback"
25+
"github.com/arduino/arduino-flasher-cli/cmd/i18n"
26+
)
27+
28+
func NewVersionCmd(version string) *cobra.Command {
29+
cmd := &cobra.Command{
30+
Use: "version",
31+
Short: "Print the version number of Arduino Flasher CLI",
32+
Run: func(cmd *cobra.Command, args []string) {
33+
feedback.PrintResult(versionResult{
34+
Name: "Arduino Flasher CLI",
35+
Version: version,
36+
})
37+
38+
latest, err := checkForUpdates(version)
39+
if err != nil {
40+
feedback.Warning(color.YellowString("\n\nFailed to check for updates: "+err.Error()) + "\n")
41+
}
42+
if latest != "" {
43+
msg := fmt.Sprintf("\n\n%s %s → %s\n%s",
44+
color.YellowString(i18n.Tr("A new release of Arduino Flasher CLI is available:")),
45+
color.CyanString(version),
46+
color.CyanString(latest),
47+
color.YellowString("https://www.arduino.cc/en/software/#flasher-tool"))
48+
feedback.Warning(msg)
49+
}
50+
},
51+
}
52+
return cmd
53+
}
54+
55+
type versionResult struct {
56+
Name string `json:"name"`
57+
Version string `json:"version"`
58+
}
59+
60+
func (r versionResult) String() string {
61+
resultMessage := fmt.Sprintf("Arduino Flasher CLI version %s", r.Version)
62+
return resultMessage
63+
}
64+
65+
func (r versionResult) Data() interface{} {
66+
return r
67+
}

0 commit comments

Comments
 (0)