@@ -2,6 +2,7 @@ package project
22
33import (
44 "net/http"
5+ "strings"
56 "time"
67
78 "github.com/cli/cli/api"
@@ -48,10 +49,16 @@ func NewCmdProject(f *cmdutil.Factory, runF func(*ProjectOptions) error) *cobra.
4849 return cmd
4950}
5051
52+ type Content struct {
53+ Title string
54+ Body string
55+ }
56+
5157type Card struct {
5258 Note string
5359 ID int
5460 ContentURL string `json:"content_url"`
61+ Content * Content
5562}
5663
5764type Column struct {
@@ -185,7 +192,10 @@ loop:
185192 }
186193 drawRect (s , cardStyle , colX + 1 , (ic * cardHeight )+ colY + 2 , cardWidth , cardHeight , bold )
187194 cardNote := card .Note
188- if len (card .Note ) > cardWidth - 2 {
195+ if cardNote == "" {
196+ cardNote = card .Content .Title
197+ }
198+ if len (cardNote ) > cardWidth - 2 {
189199 cardNote = cardNote [0 : cardWidth - 2 ]
190200 } else if cardNote == "" {
191201 cardNote = `¯\_(ツ)_/¯`
@@ -200,7 +210,29 @@ loop:
200210 infoWidth := colWidth * 2
201211 infoHeight := colHeight
202212 drawRect (s , style , infoX , infoY , infoWidth , infoHeight , true )
203- drawStr (s , infoX + 1 , infoY + 1 , style , cardInfo .Note )
213+ if cardInfo .Content != nil {
214+ title := cardInfo .Content .Title
215+ if len (title ) > infoWidth - 2 {
216+ title = title [0 : infoWidth - 2 ]
217+ }
218+ drawStr (s , infoX + 1 , infoY + 1 , style , title )
219+
220+ // TODO markdown rendering did _not_ output correctly; lots of escaped ANSI
221+
222+ bodyLines := strings .Split (cardInfo .Content .Body , "\n " )
223+ for i , line := range bodyLines {
224+ if infoY + 2 + i > infoHeight - 2 {
225+ break
226+ }
227+ outLine := line
228+ if len (outLine ) > infoWidth - 2 {
229+ outLine = outLine [0 : infoWidth - 2 ]
230+ }
231+ drawStr (s , infoX + 1 , infoY + 2 + i , style , outLine )
232+ }
233+ } else {
234+ drawStr (s , infoX + 1 , infoY + 1 , style , cardInfo .Note )
235+ }
204236
205237 s .Show ()
206238 }
0 commit comments