-
Notifications
You must be signed in to change notification settings - Fork 1
feat: check for tool updates when printing current version #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MatteoPologruto
wants to merge
4
commits into
main
Choose a base branch
from
check-for-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/arduino/go-paths-helper.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/arduino/go-windows-runas.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/codeclysm/extract/v4.dep.yml
100644 → 100755
Empty file.
35 changes: 35 additions & 0 deletions
35
.licenses/arduino-flasher-cli/go/github.com/fatih/color.dep.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 modified
0
.licenses/arduino-flasher-cli/go/github.com/h2non/filetype.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/matchers/isobmff.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/h2non/filetype/types.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/table.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/jedib0t/go-pretty/v6/text.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/juju/errors.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/fse.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/huff0.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/cpuinfo.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/le.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/internal/snapref.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/klauspost/compress/zstd/internal/xxhash.dep.yml
100644 → 100755
Empty file.
34 changes: 34 additions & 0 deletions
34
.licenses/arduino-flasher-cli/go/github.com/mattn/go-colorable.dep.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: [] |
22 changes: 22 additions & 0 deletions
22
.licenses/arduino-flasher-cli/go/github.com/mattn/go-isatty.dep.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 modified
0
.licenses/arduino-flasher-cli/go/github.com/mattn/go-runewidth.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/mitchellh/colorstring.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/rivo/uniseg.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/schollz/progressbar/v3.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/sirupsen/logrus.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/spf13/cobra.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/spf13/pflag.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/hash.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/internal/xlog.dep.yml
100644 → 100755
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/github.com/ulikunitz/xz/lzma.dep.yml
100644 → 100755
Empty file.
Empty file.
Empty file.
45 changes: 45 additions & 0 deletions
45
.licenses/arduino-flasher-cli/go/go.bug.st/relaxed-semver.dep.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
0
.licenses/arduino-flasher-cli/go/golang.org/x/sys/unix.dep.yml
100644 → 100755
Empty file.
Empty file.
Empty file modified
0
.licenses/arduino-flasher-cli/go/golang.org/x/text/width.dep.yml
100644 → 100755
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.