@@ -622,35 +622,47 @@ func formatResourcesList(resources any) (string, error) {
622622 w := tabwriter .NewWriter (& buf , 0 , 0 , 2 , ' ' , 0 )
623623 useColors := isTerminal ()
624624
625+ // NOTE: Ensure that the column headers are the same length,
626+ // including the color escape sequences!
625627 if useColors {
626- fmt .Fprintf (w , "%s%sNAME%s\t %sTYPE%s\t %sURI%s\n " ,
627- ColorBold , ColorCyan , ColorReset ,
628+ fmt .Fprintf (w , "%sNAME%s\t %sMIMETYPE%s\t %sURI%s\t %sDESCRIPTION%s\n " ,
629+ ColorCyan , ColorReset ,
630+ ColorCyan , ColorReset ,
631+ ColorCyan , ColorReset ,
632+ ColorCyan , ColorReset )
633+ fmt .Fprintf (w , "%s----%s\t %s--------%s\t %s---%s\t %s----------%s\n " ,
634+ ColorCyan , ColorReset ,
635+ ColorCyan , ColorReset ,
628636 ColorCyan , ColorReset ,
629637 ColorCyan , ColorReset )
630638 } else {
631- fmt .Fprintln (w , "NAME\t TYPE\t URI" )
639+ fmt .Fprintln (w , "NAME\t MIMETYPE\t URI\t DESCRIPTION" )
640+ fmt .Fprintln (w , "----\t --------\t ---\t -----------" )
632641 }
633642
634- fmt .Fprintln (w , "----\t ----\t ---" )
635-
636643 for _ , r := range resourcesSlice {
637644 resource , ok1 := r .(map [string ]any )
638645 if ! ok1 {
639646 continue
640647 }
641648
642649 name , _ := resource ["name" ].(string )
643- resType , _ := resource ["type " ].(string )
650+ mimeType , _ := resource ["mimeType " ].(string )
644651 uri , _ := resource ["uri" ].(string )
652+ desc , _ := resource ["description" ].(string )
653+ if len (desc ) > 50 {
654+ desc = desc [:47 ] + "..."
655+ }
645656
646657 // Use the entire URI instead of truncating
647658 if useColors {
648- fmt .Fprintf (w , "%s%s%s\t %s%s\t %s%s%s\n " ,
659+ fmt .Fprintf (w , "%s%s%s\t %s%s%s \t %s%s%s \t %s\n " ,
649660 ColorGreen , name , ColorReset ,
650- resType , ColorReset ,
651- ColorYellow , uri , ColorReset )
661+ ColorGreen , mimeType , ColorReset ,
662+ ColorYellow , uri , ColorReset ,
663+ desc )
652664 } else {
653- fmt .Fprintf (w , "%s\t %s\t %s\n " , name , resType , uri )
665+ fmt .Fprintf (w , "%s\t %s\t %s\t %s \ n " , name , mimeType , uri , desc )
654666 }
655667 }
656668
0 commit comments