diff --git a/cmd/skywire-cli/commands/transport.go b/cmd/skywire-cli/commands/transport.go index be10bc359d..41107e021c 100644 --- a/cmd/skywire-cli/commands/transport.go +++ b/cmd/skywire-cli/commands/transport.go @@ -7,6 +7,7 @@ import ( "os" "text/tabwriter" "time" + "sort" "github.com/google/uuid" "github.com/spf13/cobra" @@ -155,6 +156,7 @@ func init() { } func printTransports(tps ...*node.TransportSummary) { + sortTransports(tps...) w := tabwriter.NewWriter(os.Stdout, 0, 0, 5, ' ', tabwriter.TabIndent) _, err := fmt.Fprintln(w, "type\tid\tlocal\tremote") catch(err) @@ -176,3 +178,9 @@ func printTransportEntries(entries ...*transport.EntryWithStatus) { } catch(w.Flush()) } + +func sortTransports(tps ...*node.TransportSummary) { + sort.Slice(tps, func(i, j int) bool { + return tps[i].ID.String() < tps[j].ID.String() + }) +} \ No newline at end of file