Skip to content

Commit ca9211b

Browse files
aykevldeadprogram
authored andcommitted
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.
1 parent cb7d470 commit ca9211b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,8 +1740,12 @@ func main() {
17401740
case "ports":
17411741
serialPortInfo, err := ListSerialPorts()
17421742
handleCompilerError(err)
1743+
if len(serialPortInfo) == 0 {
1744+
fmt.Println("No serial ports found.")
1745+
}
1746+
fmt.Printf("%-20s %-9s %s\n", "Port", "ID", "Boards")
17431747
for _, s := range serialPortInfo {
1744-
fmt.Printf("%s %4s %4s %s\n", s.Name, s.VID, s.PID, s.Target)
1748+
fmt.Printf("%-20s %4s:%4s %s\n", s.Name, s.VID, s.PID, s.Target)
17451749
}
17461750
case "targets":
17471751
specs, err := compileopts.GetTargetSpecs()

0 commit comments

Comments
 (0)