File tree Expand file tree Collapse file tree 3 files changed +73
-1
lines changed Expand file tree Collapse file tree 3 files changed +73
-1
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // This file is part of serial-discovery.
3+ //
4+ // Copyright 2021 ARDUINO SA (http://www.arduino.cc/)
5+ //
6+ // This software is released under the GNU General Public License version 3,
7+ // which covers the main part of arduino-cli.
8+ // The terms of this license can be found at:
9+ // https://www.gnu.org/licenses/gpl-3.0.en.html
10+ //
11+ // You can be released from the requirements of the above licenses by purchasing
12+ // a commercial license. Buying such a license is mandatory if you want to modify or
13+ // otherwise use the software for commercial activities involving the Arduino
14+ // software without disclosing the source code of your own applications. To purchase
15+ // a commercial license, send an email to license@arduino.cc.
16+ //
17+
18+ package main
19+
20+ import (
21+ "fmt"
22+ "os"
23+ )
24+
25+ var args struct {
26+ showVersion bool
27+ }
28+
29+ func parseArgs () {
30+ for _ , arg := range os .Args [1 :] {
31+ if arg == "" {
32+ continue
33+ }
34+ if arg == "-v" || arg == "--version" {
35+ args .showVersion = true
36+ continue
37+ }
38+ fmt .Fprintf (os .Stderr , "invalid argument: %s\n " , arg )
39+ os .Exit (1 )
40+ }
41+ }
Original file line number Diff line number Diff line change 11//
22// This file is part of serial-discovery.
33//
4- // Copyright 2018 ARDUINO SA (http://www.arduino.cc/)
4+ // Copyright 2021 ARDUINO SA (http://www.arduino.cc/)
55//
66// This software is released under the GNU General Public License version 3,
77// which covers the main part of arduino-cli.
@@ -26,10 +26,17 @@ import (
2626 "sync"
2727
2828 "github.com/arduino/go-properties-orderedmap"
29+ "github.com/arduino/serial-discovery/version"
2930 "go.bug.st/serial/enumerator"
3031)
3132
3233func main () {
34+ parseArgs ()
35+ if args .showVersion {
36+ fmt .Printf ("serial-discovery %s (build timestamp: %s)\n " , version .Tag , version .Timestamp )
37+ return
38+ }
39+
3340 syncStarted := false
3441 var syncCloseChan chan <- bool
3542
Original file line number Diff line number Diff line change 1+ //
2+ // This file is part of serial-discovery.
3+ //
4+ // Copyright 2021 ARDUINO SA (http://www.arduino.cc/)
5+ //
6+ // This software is released under the GNU General Public License version 3,
7+ // which covers the main part of arduino-cli.
8+ // The terms of this license can be found at:
9+ // https://www.gnu.org/licenses/gpl-3.0.en.html
10+ //
11+ // You can be released from the requirements of the above licenses by purchasing
12+ // a commercial license. Buying such a license is mandatory if you want to modify or
13+ // otherwise use the software for commercial activities involving the Arduino
14+ // software without disclosing the source code of your own applications. To purchase
15+ // a commercial license, send an email to license@arduino.cc.
16+ //
17+
18+ package version
19+
20+ // Tag is the current git tag
21+ var Tag = "snapshot"
22+
23+ // Timestamp is the current timestamp
24+ var Timestamp = "unknown"
You can’t perform that action at this time.
0 commit comments