Skip to content

Commit cb7d470

Browse files
aykevldeadprogram
authored andcommitted
main: change monitor -info to ports
I believe this provides a better UX.
1 parent 5baee9a commit cb7d470

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

main.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ func usage(command string) {
12251225
fmt.Fprintln(os.Stderr, " gdb: run/flash and immediately enter GDB")
12261226
fmt.Fprintln(os.Stderr, " lldb: run/flash and immediately enter LLDB")
12271227
fmt.Fprintln(os.Stderr, " monitor: open communication port")
1228+
fmt.Fprintln(os.Stderr, " ports: list available serial ports")
12281229
fmt.Fprintln(os.Stderr, " env: list environment variables used during build")
12291230
fmt.Fprintln(os.Stderr, " list: run go list using the TinyGo root")
12301231
fmt.Fprintln(os.Stderr, " clean: empty cache directory ("+goenv.Get("GOCACHE")+")")
@@ -1437,7 +1438,6 @@ func main() {
14371438
llvmFeatures := flag.String("llvm-features", "", "comma separated LLVM features to enable")
14381439
cpuprofile := flag.String("cpuprofile", "", "cpuprofile output")
14391440
monitor := flag.Bool("monitor", false, "enable serial monitor")
1440-
info := flag.Bool("info", false, "print information")
14411441
baudrate := flag.Int("baudrate", 115200, "baudrate of serial monitor")
14421442

14431443
// Internal flags, that are only intended for TinyGo development.
@@ -1733,17 +1733,15 @@ func main() {
17331733
os.Exit(1)
17341734
}
17351735
case "monitor":
1736-
if *info {
1737-
serialPortInfo, err := ListSerialPorts()
1738-
handleCompilerError(err)
1739-
for _, s := range serialPortInfo {
1740-
fmt.Printf("%s %4s %4s %s\n", s.Name, s.VID, s.PID, s.Target)
1741-
}
1742-
} else {
1743-
config, err := builder.NewConfig(options)
1744-
handleCompilerError(err)
1745-
err = Monitor("", *port, config)
1746-
handleCompilerError(err)
1736+
config, err := builder.NewConfig(options)
1737+
handleCompilerError(err)
1738+
err = Monitor("", *port, config)
1739+
handleCompilerError(err)
1740+
case "ports":
1741+
serialPortInfo, err := ListSerialPorts()
1742+
handleCompilerError(err)
1743+
for _, s := range serialPortInfo {
1744+
fmt.Printf("%s %4s %4s %s\n", s.Name, s.VID, s.PID, s.Target)
17471745
}
17481746
case "targets":
17491747
specs, err := compileopts.GetTargetSpecs()

0 commit comments

Comments
 (0)