aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-02-22 20:38:50 +0100
committerRon Evans <[email protected]>2024-02-23 08:37:26 +0100
commitcb7d470ba45af260e3ec9a0ebf7b066be5a7b311 (patch)
tree0c2fcaf1785358172b515879ac9214e310eacf3a
parent5baee9a8ee4f958b8adb4d336fbb6ac522269dfc (diff)
downloadtinygo-cb7d470ba45af260e3ec9a0ebf7b066be5a7b311.tar.gz
tinygo-cb7d470ba45af260e3ec9a0ebf7b066be5a7b311.zip
main: change `monitor -info` to `ports`
I believe this provides a better UX.
-rw-r--r--main.go22
1 files changed, 10 insertions, 12 deletions
diff --git a/main.go b/main.go
index 1a9e624e4..64c3389a9 100644
--- a/main.go
+++ b/main.go
@@ -1225,6 +1225,7 @@ func usage(command string) {
fmt.Fprintln(os.Stderr, " gdb: run/flash and immediately enter GDB")
fmt.Fprintln(os.Stderr, " lldb: run/flash and immediately enter LLDB")
fmt.Fprintln(os.Stderr, " monitor: open communication port")
+ fmt.Fprintln(os.Stderr, " ports: list available serial ports")
fmt.Fprintln(os.Stderr, " env: list environment variables used during build")
fmt.Fprintln(os.Stderr, " list: run go list using the TinyGo root")
fmt.Fprintln(os.Stderr, " clean: empty cache directory ("+goenv.Get("GOCACHE")+")")
@@ -1437,7 +1438,6 @@ func main() {
llvmFeatures := flag.String("llvm-features", "", "comma separated LLVM features to enable")
cpuprofile := flag.String("cpuprofile", "", "cpuprofile output")
monitor := flag.Bool("monitor", false, "enable serial monitor")
- info := flag.Bool("info", false, "print information")
baudrate := flag.Int("baudrate", 115200, "baudrate of serial monitor")
// Internal flags, that are only intended for TinyGo development.
@@ -1733,17 +1733,15 @@ func main() {
os.Exit(1)
}
case "monitor":
- if *info {
- serialPortInfo, err := ListSerialPorts()
- handleCompilerError(err)
- for _, s := range serialPortInfo {
- fmt.Printf("%s %4s %4s %s\n", s.Name, s.VID, s.PID, s.Target)
- }
- } else {
- config, err := builder.NewConfig(options)
- handleCompilerError(err)
- err = Monitor("", *port, config)
- handleCompilerError(err)
+ config, err := builder.NewConfig(options)
+ handleCompilerError(err)
+ err = Monitor("", *port, config)
+ handleCompilerError(err)
+ case "ports":
+ serialPortInfo, err := ListSerialPorts()
+ handleCompilerError(err)
+ for _, s := range serialPortInfo {
+ fmt.Printf("%s %4s %4s %s\n", s.Name, s.VID, s.PID, s.Target)
}
case "targets":
specs, err := compileopts.GetTargetSpecs()