@@ -313,34 +313,35 @@ func (c *command) Parent() *command {
313313
314314func WriteListCVDsOutput (w io.Writer , hosts []* RemoteHost ) {
315315 for _ , host := range hosts {
316- fmt .Fprintln (w , hostOutput (host ))
317- if len (host .CVDs ) == 0 {
318- fmt .Fprintln (w , " ~~Empty~~ " )
319- fmt .Fprintln (w , "" )
320- continue
321- }
316+ hostOutput (w , host )
317+ cvdMap := make (map [string ][]* RemoteCVD )
322318 for _ , cvd := range host .CVDs {
323- lines := cvdOutput (host , cvd )
324- for _ , l := range lines {
325- fmt .Fprintln (w , " " + l )
319+ cvdMap [cvd .Group ] = append (cvdMap [cvd .Group ], cvd )
320+ }
321+ for group , cvds := range cvdMap {
322+ groupOutput (w , group )
323+ for _ , cvd := range cvds {
324+ cvdOutput (w , host , cvd )
326325 }
327- fmt .Fprintln (w )
328326 }
329327 }
330328}
331329
332- func hostOutput (h * RemoteHost ) string {
333- return fmt .Sprintf ("%s (%s/)" , h .Name , h .ServiceURL )
330+ func hostOutput (w io.Writer , h * RemoteHost ) {
331+ fmt .Fprintf (w , "Host: %s\n " , h .Name )
332+ fmt .Fprintf (w , " WebUI: %s/\n " , h .ServiceURL )
334333}
335334
336- func cvdOutput (h * RemoteHost , c * RemoteCVD ) []string {
337- return []string {
338- fmt .Sprintf ("%s/%s" , c .Group , c .Name ),
339- "Status: " + c .Status ,
340- "ADB: " + adbStateStr (c ),
341- "Displays: " + fmt .Sprintf ("%v" , c .Displays ),
342- "Logs: " + fmt .Sprintf ("%s/cvds/%s/%s/logs/" , h .ServiceURL , c .Group , c .Name ),
343- }
335+ func groupOutput (w io.Writer , group string ) {
336+ fmt .Fprintf (w , " Group: %s\n " , group )
337+ }
338+
339+ func cvdOutput (w io.Writer , h * RemoteHost , c * RemoteCVD ) {
340+ fmt .Fprintf (w , " Instance: %s\n " , c .Name )
341+ fmt .Fprintf (w , " Status: %s\n " , c .Status )
342+ fmt .Fprintf (w , " ADB: %s\n " , adbStateStr (c ))
343+ fmt .Fprintf (w , " Displays: %v\n " , c .Displays )
344+ fmt .Fprintf (w , " Logs: %s/cvds/%s/%s/logs/\n " , h .ServiceURL , c .Group , c .Name )
344345}
345346
346347func adbStateStr (c * RemoteCVD ) string {
0 commit comments