From ca9211b582e9295c167e5ec5cdef2265823861ca Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 22 Feb 2024 20:39:56 +0100 Subject: [PATCH] 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. --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 64c3389a..8c0117fa 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()