From ed582a56ebbbef7eb4a9978f59ac68eeb2aadb4f Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Tue, 4 Nov 2025 17:46:59 +0100 Subject: [PATCH 01/10] feat: check for tool updates when printing current version --- check_for_updates.go | 63 ++++++++++++++++++++++++++++++++++++++++++++ go.mod | 3 ++- go.sum | 2 ++ main.go | 6 ++++- 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 check_for_updates.go diff --git a/check_for_updates.go b/check_for_updates.go new file mode 100644 index 0000000..4954ca9 --- /dev/null +++ b/check_for_updates.go @@ -0,0 +1,63 @@ +package main + +import ( + "encoding/json" + "fmt" + "net/http" + "strings" + + "github.com/fatih/color" + semver "go.bug.st/relaxed-semver" + + "github.com/arduino/arduino-flasher-cli/feedback" + "github.com/arduino/arduino-flasher-cli/i18n" + "github.com/arduino/arduino-flasher-cli/updater" +) + +type FlasherRelease struct { + TagName string `json:"tag_name"` +} + +func checkForUpdates() error { + currentVersion, err := semver.Parse(Version) + if err != nil { + return err + } + + c := updater.NewClient() + req, err := http.NewRequest("GET", "https://api.github.com/repos/arduino/arduino-flasher-cli/releases/latest", nil) + if err != nil { + return err + } + resp, err := c.HTTPClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + var release FlasherRelease + err = json.NewDecoder(resp.Body).Decode(&release) + if err != nil { + return err + } + + release.TagName = strings.TrimPrefix(release.TagName, "v") + latestVersion, err := semver.Parse(release.TagName) + if err != nil { + return err + } + + // Do nothing if the Arduino Flasher CLI is up to date + if currentVersion.GreaterThanOrEqual(latestVersion) { + return nil + } + + msg := fmt.Sprintf("\n\n%s %s → %s\n%s", + color.YellowString(i18n.Tr("A new release of Arduino Flasher CLI is available:")), + color.CyanString(currentVersion.String()), + color.CyanString(latestVersion.String()), + color.YellowString("https://github.com/arduino/arduino-flasher-cli/releases/latest")) + feedback.Print(msg) + + return nil +} diff --git a/go.mod b/go.mod index 1f966aa..f08eb04 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/arduino/go-paths-helper v1.14.0 github.com/arduino/go-windows-runas v1.0.1 github.com/codeclysm/extract/v4 v4.0.0 + github.com/fatih/color v1.18.0 github.com/jedib0t/go-pretty/v6 v6.6.8 github.com/leonelquinteros/gotext v1.7.2 github.com/schollz/progressbar/v3 v3.18.0 @@ -14,6 +15,7 @@ require ( github.com/stretchr/testify v1.10.0 go.bug.st/cleanup v1.0.0 go.bug.st/f v0.4.0 + go.bug.st/relaxed-semver v0.15.0 ) require ( @@ -31,7 +33,6 @@ require ( github.com/dominikbraun/graph v0.23.0 // indirect github.com/elliotchance/orderedmap/v3 v3.1.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect - github.com/fatih/color v1.18.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.6.2 // indirect diff --git a/go.sum b/go.sum index 386a8c9..8bf5157 100644 --- a/go.sum +++ b/go.sum @@ -171,6 +171,8 @@ go.bug.st/cleanup v1.0.0 h1:XVj1HZxkBXeq3gMT7ijWUpHyIC1j8XAoNSyQ06CskgA= go.bug.st/cleanup v1.0.0/go.mod h1:EqVmTg2IBk4znLbPD28xne3abjsJftMdqqJEjhn70bk= go.bug.st/f v0.4.0 h1:Vstqb950nMA+PhAlRxUw8QL1ntHy/gXHNyyzjkQLJ10= go.bug.st/f v0.4.0/go.mod h1:bMo23205ll7UW63KwO1ut5RdlJ9JK8RyEEr88CmOF5Y= +go.bug.st/relaxed-semver v0.15.0 h1:w37+SYQPxF53RQO7QZZuPIMaPouOifdaP0B1ktst2nA= +go.bug.st/relaxed-semver v0.15.0/go.mod h1:bwHiCtYuD2m716tBk2OnOBjelsbXw9el5EIuyxT/ksU= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= diff --git a/main.go b/main.go index 7ef5573..6e3f7da 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,11 @@ func main() { Use: "version", Short: "Print the version number of Arduino Flasher CLI", Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Arduino Flasher CLI v" + Version) + fmt.Println("Arduino Flasher CLI " + Version) + err := checkForUpdates() + if err != nil { + feedback.Warning("failed to check for updates: " + err.Error()) + } }, }) From 4ea0fc23698b88ffbc9b94bdcb66ede09bf4fe70 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Tue, 4 Nov 2025 17:54:10 +0100 Subject: [PATCH 02/10] Update licenses --- .../arduino/go-paths-helper.dep.yml | 0 .../arduino/go-windows-runas.dep.yml | 0 .../github.com/codeclysm/extract/v4.dep.yml | 0 .../go/github.com/fatih/color.dep.yml | 35 ++++++++ .../go/github.com/h2non/filetype.dep.yml | 0 .../h2non/filetype/matchers.dep.yml | 0 .../h2non/filetype/matchers/isobmff.dep.yml | 0 .../github.com/h2non/filetype/types.dep.yml | 0 .../jedib0t/go-pretty/v6/table.dep.yml | 0 .../jedib0t/go-pretty/v6/text.dep.yml | 0 .../go/github.com/juju/errors.dep.yml | 0 .../go/github.com/klauspost/compress.dep.yml | 0 .../github.com/klauspost/compress/fse.dep.yml | 0 .../klauspost/compress/huff0.dep.yml | 0 .../compress/internal/cpuinfo.dep.yml | 0 .../klauspost/compress/internal/le.dep.yml | 0 .../compress/internal/snapref.dep.yml | 0 .../klauspost/compress/zstd.dep.yml | 0 .../compress/zstd/internal/xxhash.dep.yml | 0 .../go/github.com/mattn/go-colorable.dep.yml | 34 ++++++++ .../go/github.com/mattn/go-isatty.dep.yml | 22 +++++ .../go/github.com/mattn/go-runewidth.dep.yml | 0 .../github.com/mitchellh/colorstring.dep.yml | 0 .../go/github.com/rivo/uniseg.dep.yml | 0 .../github.com/schollz/progressbar/v3.dep.yml | 0 .../go/github.com/sirupsen/logrus.dep.yml | 0 .../go/github.com/spf13/cobra.dep.yml | 0 .../go/github.com/spf13/pflag.dep.yml | 0 .../go/github.com/ulikunitz/xz.dep.yml | 0 .../ulikunitz/xz/internal/hash.dep.yml | 0 .../ulikunitz/xz/internal/xlog.dep.yml | 0 .../go/github.com/ulikunitz/xz/lzma.dep.yml | 0 .../go/go.bug.st/cleanup.dep.yml | 0 .../go/go.bug.st/f.dep.yml | 0 .../go/go.bug.st/relaxed-semver.dep.yml | 45 +++++++++++ .../go/golang.org/x/sys/unix.dep.yml | 0 .../go/golang.org/x/term.dep.yml | 0 .../go/golang.org/x/text/width.dep.yml | 0 .../go/gopkg.in/yaml.v3.dep.yml | 80 +++++++++++++++++++ 39 files changed, 216 insertions(+) mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml create mode 100755 .licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml create mode 100755 .licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml create mode 100755 .licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml create mode 100755 .licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml mode change 100644 => 100755 .licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml create mode 100755 .licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml diff --git a/.licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml new file mode 100755 index 0000000..3c49fef --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml @@ -0,0 +1,35 @@ +--- +name: github.com/fatih/color +version: v1.18.0 +type: go +summary: Package color is an ANSI color package to output colorized or SGR defined + output to the standard output. +homepage: https://pkg.go.dev/github.com/fatih/color +license: mit +licenses: +- sources: LICENSE.md + text: | + The MIT License (MIT) + + Copyright (c) 2013 Fatih Arslan + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- sources: README.md + text: The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) + for more details +notices: [] diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml new file mode 100755 index 0000000..2bc368b --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml @@ -0,0 +1,34 @@ +--- +name: github.com/mattn/go-colorable +version: v0.1.13 +type: go +summary: +homepage: https://pkg.go.dev/github.com/mattn/go-colorable +license: mit +licenses: +- sources: LICENSE + text: | + The MIT License (MIT) + + Copyright (c) 2016 Yasuhiro Matsumoto + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +- sources: README.md + text: MIT +notices: [] diff --git a/.licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml new file mode 100755 index 0000000..fcf3912 --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml @@ -0,0 +1,22 @@ +--- +name: github.com/mattn/go-isatty +version: v0.0.20 +type: go +summary: Package isatty implements interface to isatty +homepage: https://pkg.go.dev/github.com/mattn/go-isatty +license: mit +licenses: +- sources: LICENSE + text: | + Copyright (c) Yasuhiro MATSUMOTO + + MIT License (Expat) + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- sources: README.md + text: MIT +notices: [] diff --git a/.licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml b/.licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml b/.licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml b/.licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml new file mode 100755 index 0000000..36bfdcf --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml @@ -0,0 +1,45 @@ +--- +name: go.bug.st/relaxed-semver +version: v0.15.0 +type: go +summary: +homepage: https://pkg.go.dev/go.bug.st/relaxed-semver +license: bsd-3-clause +licenses: +- sources: LICENSE + text: |2+ + + Copyright (c) 2018-2025, Cristian Maglie. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +notices: [] +... diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml old mode 100644 new mode 100755 diff --git a/.licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml b/.licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml new file mode 100755 index 0000000..e77248e --- /dev/null +++ b/.licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml @@ -0,0 +1,80 @@ +--- +name: gopkg.in/yaml.v3 +version: v3.0.1 +type: go +summary: Package yaml implements YAML support for the Go language. +homepage: https://pkg.go.dev/gopkg.in/yaml.v3 +license: other +licenses: +- sources: LICENSE + text: |2 + + This project is covered by two different licenses: MIT and Apache. + + #### MIT License #### + + The following files were ported to Go from C files of libyaml, and thus + are still covered by their original MIT license, with the additional + copyright staring in 2011 when the project was ported over: + + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go + + Copyright (c) 2006-2010 Kirill Simonov + Copyright (c) 2006-2011 Kirill Simonov + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to do + so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + ### Apache License ### + + All the remaining project files are covered by the Apache license: + + Copyright (c) 2011-2019 Canonical Ltd + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +- sources: README.md + text: |- + The yaml package is licensed under the MIT and Apache License 2.0 licenses. + Please see the LICENSE file for details. +notices: +- sources: NOTICE + text: |- + Copyright 2011-2016 Canonical Ltd. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 1bfd1bfeaed0ac86bebb458dafcf2699de278173 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Tue, 4 Nov 2025 17:55:01 +0100 Subject: [PATCH 03/10] Add license to new file --- check_for_updates.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/check_for_updates.go b/check_for_updates.go index 4954ca9..a3e1040 100644 --- a/check_for_updates.go +++ b/check_for_updates.go @@ -1,3 +1,18 @@ +// This file is part of arduino-flasher-cli. +// +// Copyright 2025 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-flasher-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + package main import ( From 1899741a4e890a2ff0727669d23d25b6499e0522 Mon Sep 17 00:00:00 2001 From: MatteoPologruto <109663225+MatteoPologruto@users.noreply.github.com> Date: Wed, 5 Nov 2025 11:56:50 +0100 Subject: [PATCH 04/10] Update check_for_updates.go Co-authored-by: Per Tillisch --- check_for_updates.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_for_updates.go b/check_for_updates.go index a3e1040..4c95440 100644 --- a/check_for_updates.go +++ b/check_for_updates.go @@ -71,7 +71,7 @@ func checkForUpdates() error { color.YellowString(i18n.Tr("A new release of Arduino Flasher CLI is available:")), color.CyanString(currentVersion.String()), color.CyanString(latestVersion.String()), - color.YellowString("https://github.com/arduino/arduino-flasher-cli/releases/latest")) + color.YellowString("https://www.arduino.cc/en/software/#flasher-tool")) feedback.Print(msg) return nil From b41d2c061d15c9e0412988a5258339b03594296f Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 10 Nov 2025 12:00:23 +0100 Subject: [PATCH 05/10] Revert executable changes to .licenses files --- .../go/github.com/arduino/go-paths-helper.dep.yml | 0 .../go/github.com/arduino/go-windows-runas.dep.yml | 0 .../go/github.com/codeclysm/extract/v4.dep.yml | 0 .licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml | 0 .../arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml | 0 .../go/github.com/h2non/filetype/matchers.dep.yml | 0 .../go/github.com/h2non/filetype/matchers/isobmff.dep.yml | 0 .../go/github.com/h2non/filetype/types.dep.yml | 0 .../go/github.com/jedib0t/go-pretty/v6/table.dep.yml | 0 .../go/github.com/jedib0t/go-pretty/v6/text.dep.yml | 0 .licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml | 0 .../arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml | 0 .../go/github.com/klauspost/compress/fse.dep.yml | 0 .../go/github.com/klauspost/compress/huff0.dep.yml | 0 .../go/github.com/klauspost/compress/internal/cpuinfo.dep.yml | 0 .../go/github.com/klauspost/compress/internal/le.dep.yml | 0 .../go/github.com/klauspost/compress/internal/snapref.dep.yml | 0 .../go/github.com/klauspost/compress/zstd.dep.yml | 0 .../go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml | 0 .../arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml | 0 .../arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml | 0 .../arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml | 0 .../go/github.com/mitchellh/colorstring.dep.yml | 0 .licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml | 0 .../go/github.com/schollz/progressbar/v3.dep.yml | 0 .../arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml | 0 .licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml | 0 .licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml | 0 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml | 0 .../go/github.com/ulikunitz/xz/internal/hash.dep.yml | 0 .../go/github.com/ulikunitz/xz/internal/xlog.dep.yml | 0 .../arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml | 0 .licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml | 0 .licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml | 0 .licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml | 0 .licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml | 0 .licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml | 0 .licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml | 0 .licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml | 0 39 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml mode change 100755 => 100644 .licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml diff --git a/.licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml b/.licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml b/.licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml b/.licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml b/.licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml old mode 100755 new mode 100644 diff --git a/.licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml b/.licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml old mode 100755 new mode 100644 From fa879d2cc0620ce490ea50d7876721e7ecf9bc86 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 10 Nov 2025 12:35:44 +0100 Subject: [PATCH 06/10] Check for updates after each command --- download.go | 5 +++++ feedback/feedback.go | 9 +-------- flash.go | 5 +++++ go.mod | 1 - go.sum | 4 ---- list.go | 4 ++++ main.go | 5 ++--- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/download.go b/download.go index 6197139..9dc2d06 100644 --- a/download.go +++ b/download.go @@ -55,4 +55,9 @@ func runDownloadCommand(args []string, destDir string) { if err != nil { feedback.Fatal(i18n.Tr("error downloading the image: %v", err), feedback.ErrBadArgument) } + + err = checkForUpdates() + if err != nil { + feedback.Warning("\n\nfailed to check for updates: " + err.Error()) + } } diff --git a/feedback/feedback.go b/feedback/feedback.go index 5fa9d0d..1a494f0 100644 --- a/feedback/feedback.go +++ b/feedback/feedback.go @@ -22,8 +22,6 @@ import ( "io" "os" - "github.com/sirupsen/logrus" - "github.com/arduino/arduino-flasher-cli/i18n" ) @@ -156,12 +154,7 @@ func Print(v string) { // Warning outputs a warning message. func Warning(msg string) { - if format == Text { - fmt.Fprintln(feedbackErr, msg) - } else { - bufferWarnings = append(bufferWarnings, msg) - } - logrus.Warning(msg) + fmt.Fprintln(feedbackErr, msg) } // FatalError outputs the error and exits with status exitCode. diff --git a/flash.go b/flash.go index a439185..99b7a56 100644 --- a/flash.go +++ b/flash.go @@ -96,4 +96,9 @@ func runFlashCommand(ctx context.Context, args []string, forceYes bool) { if err != nil { feedback.Fatal(i18n.Tr("error flashing the board: %v", err), feedback.ErrBadArgument) } + + err = checkForUpdates() + if err != nil { + feedback.Warning("\n\nfailed to check for updates: " + err.Error()) + } } diff --git a/go.mod b/go.mod index f08eb04..de502a1 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/jedib0t/go-pretty/v6 v6.6.8 github.com/leonelquinteros/gotext v1.7.2 github.com/schollz/progressbar/v3 v3.18.0 - github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.9.1 github.com/stretchr/testify v1.10.0 go.bug.st/cleanup v1.0.0 diff --git a/go.sum b/go.sum index 8bf5157..1d2eda4 100644 --- a/go.sum +++ b/go.sum @@ -142,8 +142,6 @@ github.com/sebdah/goldie/v2 v2.7.1/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvK github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= @@ -156,7 +154,6 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= @@ -209,7 +206,6 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= mvdan.cc/sh/v3 v3.12.0 h1:ejKUR7ONP5bb+UGHGEG/k9V5+pRVIyD+LsZz7o8KHrI= diff --git a/list.go b/list.go index 3902cf0..75970a1 100644 --- a/list.go +++ b/list.go @@ -46,6 +46,10 @@ func runListCommand() { } feedback.PrintResult(listResult{Latest: manifest.Latest, Releases: manifest.Releases}) + err = checkForUpdates() + if err != nil { + feedback.Warning("\n\nfailed to check for updates: " + err.Error()) + } } type listResult struct { diff --git a/main.go b/main.go index 6e3f7da..e174e01 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,6 @@ package main import ( "context" - "fmt" "log/slog" "os" @@ -60,10 +59,10 @@ func main() { Use: "version", Short: "Print the version number of Arduino Flasher CLI", Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Arduino Flasher CLI " + Version) + feedback.Print("Arduino Flasher CLI " + Version) err := checkForUpdates() if err != nil { - feedback.Warning("failed to check for updates: " + err.Error()) + feedback.Warning("\n\nfailed to check for updates: " + err.Error()) } }, }) From 282e365c20cf705470e2754e41ef356f5a9fc17b Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 10 Nov 2025 15:25:26 +0100 Subject: [PATCH 07/10] Apply review suggestions --- check_for_updates.go | 27 ++++++++++++--------------- download.go | 5 ++++- flash.go | 5 ++++- list.go | 5 ++++- main.go | 5 ++++- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/check_for_updates.go b/check_for_updates.go index 4c95440..cd02292 100644 --- a/check_for_updates.go +++ b/check_for_updates.go @@ -24,47 +24,45 @@ import ( "github.com/fatih/color" semver "go.bug.st/relaxed-semver" - "github.com/arduino/arduino-flasher-cli/feedback" "github.com/arduino/arduino-flasher-cli/i18n" "github.com/arduino/arduino-flasher-cli/updater" ) -type FlasherRelease struct { - TagName string `json:"tag_name"` -} - -func checkForUpdates() error { +func checkForUpdates() (string, error) { currentVersion, err := semver.Parse(Version) if err != nil { - return err + return "", err } c := updater.NewClient() req, err := http.NewRequest("GET", "https://api.github.com/repos/arduino/arduino-flasher-cli/releases/latest", nil) if err != nil { - return err + return "", err } resp, err := c.HTTPClient.Do(req) if err != nil { - return err + return "", err } defer resp.Body.Close() - var release FlasherRelease + var release struct { + TagName string `json:"tag_name"` + } + err = json.NewDecoder(resp.Body).Decode(&release) if err != nil { - return err + return "", err } release.TagName = strings.TrimPrefix(release.TagName, "v") latestVersion, err := semver.Parse(release.TagName) if err != nil { - return err + return "", err } // Do nothing if the Arduino Flasher CLI is up to date if currentVersion.GreaterThanOrEqual(latestVersion) { - return nil + return "", nil } msg := fmt.Sprintf("\n\n%s %s → %s\n%s", @@ -72,7 +70,6 @@ func checkForUpdates() error { color.CyanString(currentVersion.String()), color.CyanString(latestVersion.String()), color.YellowString("https://www.arduino.cc/en/software/#flasher-tool")) - feedback.Print(msg) - return nil + return msg, nil } diff --git a/download.go b/download.go index 9dc2d06..3be0058 100644 --- a/download.go +++ b/download.go @@ -56,8 +56,11 @@ func runDownloadCommand(args []string, destDir string) { feedback.Fatal(i18n.Tr("error downloading the image: %v", err), feedback.ErrBadArgument) } - err = checkForUpdates() + msg, err := checkForUpdates() if err != nil { feedback.Warning("\n\nfailed to check for updates: " + err.Error()) } + if msg != "" { + feedback.Print(msg) + } } diff --git a/flash.go b/flash.go index 99b7a56..5a4b975 100644 --- a/flash.go +++ b/flash.go @@ -97,8 +97,11 @@ func runFlashCommand(ctx context.Context, args []string, forceYes bool) { feedback.Fatal(i18n.Tr("error flashing the board: %v", err), feedback.ErrBadArgument) } - err = checkForUpdates() + msg, err := checkForUpdates() if err != nil { feedback.Warning("\n\nfailed to check for updates: " + err.Error()) } + if msg != "" { + feedback.Print(msg) + } } diff --git a/list.go b/list.go index 75970a1..fc02e66 100644 --- a/list.go +++ b/list.go @@ -46,10 +46,13 @@ func runListCommand() { } feedback.PrintResult(listResult{Latest: manifest.Latest, Releases: manifest.Releases}) - err = checkForUpdates() + msg, err := checkForUpdates() if err != nil { feedback.Warning("\n\nfailed to check for updates: " + err.Error()) } + if msg != "" { + feedback.Print(msg) + } } type listResult struct { diff --git a/main.go b/main.go index e174e01..2e534d1 100644 --- a/main.go +++ b/main.go @@ -60,10 +60,13 @@ func main() { Short: "Print the version number of Arduino Flasher CLI", Run: func(cmd *cobra.Command, args []string) { feedback.Print("Arduino Flasher CLI " + Version) - err := checkForUpdates() + msg, err := checkForUpdates() if err != nil { feedback.Warning("\n\nfailed to check for updates: " + err.Error()) } + if msg != "" { + feedback.Print(msg) + } }, }) From b8cd286a307c3012941ab1250b9d46cc2fbe3660 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 10 Nov 2025 15:44:12 +0100 Subject: [PATCH 08/10] Remove unused license --- .../go/github.com/sirupsen/logrus.dep.yml | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 .licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml diff --git a/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml b/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml deleted file mode 100644 index 07801f9..0000000 --- a/.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: github.com/sirupsen/logrus -version: v1.9.3 -type: go -summary: Package logrus is a structured logger for Go, completely API compatible with - the standard library logger. -homepage: https://pkg.go.dev/github.com/sirupsen/logrus -license: mit -licenses: -- sources: LICENSE - text: | - The MIT License (MIT) - - Copyright (c) 2014 Simon Eskildsen - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -notices: [] From 6f3ace8d581e2e9eedad45a82e4b8494784f0cf9 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Mon, 10 Nov 2025 16:22:24 +0100 Subject: [PATCH 09/10] Check for updates only when version command is run --- download.go | 8 -------- flash.go | 8 -------- list.go | 7 ------- 3 files changed, 23 deletions(-) diff --git a/download.go b/download.go index 3be0058..6197139 100644 --- a/download.go +++ b/download.go @@ -55,12 +55,4 @@ func runDownloadCommand(args []string, destDir string) { if err != nil { feedback.Fatal(i18n.Tr("error downloading the image: %v", err), feedback.ErrBadArgument) } - - msg, err := checkForUpdates() - if err != nil { - feedback.Warning("\n\nfailed to check for updates: " + err.Error()) - } - if msg != "" { - feedback.Print(msg) - } } diff --git a/flash.go b/flash.go index 5a4b975..a439185 100644 --- a/flash.go +++ b/flash.go @@ -96,12 +96,4 @@ func runFlashCommand(ctx context.Context, args []string, forceYes bool) { if err != nil { feedback.Fatal(i18n.Tr("error flashing the board: %v", err), feedback.ErrBadArgument) } - - msg, err := checkForUpdates() - if err != nil { - feedback.Warning("\n\nfailed to check for updates: " + err.Error()) - } - if msg != "" { - feedback.Print(msg) - } } diff --git a/list.go b/list.go index fc02e66..3902cf0 100644 --- a/list.go +++ b/list.go @@ -46,13 +46,6 @@ func runListCommand() { } feedback.PrintResult(listResult{Latest: manifest.Latest, Releases: manifest.Releases}) - msg, err := checkForUpdates() - if err != nil { - feedback.Warning("\n\nfailed to check for updates: " + err.Error()) - } - if msg != "" { - feedback.Print(msg) - } } type listResult struct { From 94aa4c7e43b993fd4fa232738a4afdbf9dbd6bde Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Tue, 11 Nov 2025 18:32:23 +0100 Subject: [PATCH 10/10] Apply review suggestion --- check_for_updates.go | 11 +---------- main.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/check_for_updates.go b/check_for_updates.go index cd02292..77af95e 100644 --- a/check_for_updates.go +++ b/check_for_updates.go @@ -17,14 +17,11 @@ package main import ( "encoding/json" - "fmt" "net/http" "strings" - "github.com/fatih/color" semver "go.bug.st/relaxed-semver" - "github.com/arduino/arduino-flasher-cli/i18n" "github.com/arduino/arduino-flasher-cli/updater" ) @@ -65,11 +62,5 @@ func checkForUpdates() (string, error) { return "", nil } - msg := fmt.Sprintf("\n\n%s %s → %s\n%s", - color.YellowString(i18n.Tr("A new release of Arduino Flasher CLI is available:")), - color.CyanString(currentVersion.String()), - color.CyanString(latestVersion.String()), - color.YellowString("https://www.arduino.cc/en/software/#flasher-tool")) - - return msg, nil + return latestVersion.String(), nil } diff --git a/main.go b/main.go index 2e534d1..7c1afe1 100644 --- a/main.go +++ b/main.go @@ -17,9 +17,11 @@ package main import ( "context" + "fmt" "log/slog" "os" + "github.com/fatih/color" "github.com/spf13/cobra" "go.bug.st/cleanup" @@ -60,11 +62,16 @@ func main() { Short: "Print the version number of Arduino Flasher CLI", Run: func(cmd *cobra.Command, args []string) { feedback.Print("Arduino Flasher CLI " + Version) - msg, err := checkForUpdates() + latest, err := checkForUpdates() if err != nil { feedback.Warning("\n\nfailed to check for updates: " + err.Error()) } - if msg != "" { + if latest != "" { + msg := fmt.Sprintf("\n\n%s %s → %s\n%s", + color.YellowString(i18n.Tr("A new release of Arduino Flasher CLI is available:")), + color.CyanString(Version), + color.CyanString(latest), + color.YellowString("https://www.arduino.cc/en/software/#flasher-tool")) feedback.Print(msg) } },