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.
Этот коммит содержится в:
Ayke van Laethem 2024-02-22 20:39:56 +01:00 коммит произвёл Ron Evans
родитель cb7d470ba4
коммит ca9211b582

Просмотреть файл

@ -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()