Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file.
Empty file.
35 changes: 35 additions & 0 deletions .licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml
Original file line number Diff line number Diff line change
@@ -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: []
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -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: []
Original file line number Diff line number Diff line change
@@ -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 <mattn.jp@gmail.com>

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: []
Empty file.
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml
100644 → 100755
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/go.bug.st/cleanup.dep.yml
100644 → 100755
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/go.bug.st/f.dep.yml
100644 → 100755
Empty file.
45 changes: 45 additions & 0 deletions .licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml
Original file line number Diff line number Diff line change
@@ -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: []
...
Empty file modified .licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml
100644 → 100755
Empty file.
Empty file modified .licenses/arduino-flasher-cli/go/golang.org/x/term.dep.yml
100644 → 100755
Empty file.
Empty file.
80 changes: 80 additions & 0 deletions .licenses/arduino-flasher-cli/go/gopkg.in/yaml.v3.dep.yml
Original file line number Diff line number Diff line change
@@ -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.
78 changes: 78 additions & 0 deletions check_for_updates.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// 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 (
"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
}
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 (
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
},
})

Expand Down