aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-02-22 20:39:56 +0100
committerRon Evans <[email protected]>2024-02-23 08:37:26 +0100
commitca9211b582e9295c167e5ec5cdef2265823861ca (patch)
tree4a79cb966c8d96a527c744e6dab7e46af31e9e49
parentcb7d470ba45af260e3ec9a0ebf7b066be5a7b311 (diff)
downloadtinygo-ca9211b582e9295c167e5ec5cdef2265823861ca.tar.gz
tinygo-ca9211b582e9295c167e5ec5cdef2265823861ca.zip
main: make `ports` subcommand more verbose
By listing column headers and printing a message when no ports are found, it should be a bit easier to use.
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 64c3389a9..8c0117fa1 100644
--- a/main.go
+++ b/main.go
@@ -1740,8 +1740,12 @@ func main() {
case "ports":
serialPortInfo, err := ListSerialPorts()
handleCompilerError(err)
+ if len(serialPortInfo) == 0 {
+ fmt.Println("No serial ports found.")
+ }
+ fmt.Printf("%-20s %-9s %s\n", "Port", "ID", "Boards")
for _, s := range serialPortInfo {
- fmt.Printf("%s %4s %4s %s\n", s.Name, s.VID, s.PID, s.Target)
+ fmt.Printf("%-20s %4s:%4s %s\n", s.Name, s.VID, s.PID, s.Target)
}
case "targets":
specs, err := compileopts.GetTargetSpecs()