MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / showItemPRStatus

Function showItemPRStatus

cmd/pad/cmd_github.go:365–388  ·  view source on GitHub ↗

Helper functions for GitHub integration

(item *models.Item, bold, dim *color.Color)

Source from the content-addressed store, hash-verified

363// Helper functions for GitHub integration
364
365func showItemPRStatus(item *models.Item, bold, dim *color.Color) error {
366 pr := extractPRFromItem(item)
367 if pr == nil {
368 return fmt.Errorf("item %q has no linked PR", item.Slug)
369 }
370
371 ref := cli.ItemRef(*item)
372 stateColor := prStateColor(pr.State)
373
374 bold.Printf("%s %s\n", ref, item.Title)
375 fmt.Printf("PR #%d %s %s\n", pr.Number, stateColor.Sprint(pr.State), dim.Sprint(pr.URL))
376 if pr.Branch != "" {
377 fmt.Printf("Branch: %s\n", dim.Sprint(pr.Branch))
378 }
379 if pr.Repo != "" {
380 fmt.Printf("Repo: %s\n", dim.Sprint(pr.Repo))
381 }
382 if pr.UpdatedAt != "" {
383 if t, err := time.Parse(time.RFC3339, pr.UpdatedAt); err == nil {
384 fmt.Printf("Updated: %s\n", dim.Sprint(relativeTimeStr(t)))
385 }
386 }
387 return nil
388}
389
390func extractPRFromItem(item *models.Item) *GitHubPR {
391 if item == nil || item.CodeContext == nil || item.CodeContext.PullRequest == nil {

Callers 1

githubStatusCmdFunction · 0.85

Calls 4

ItemRefFunction · 0.92
extractPRFromItemFunction · 0.85
prStateColorFunction · 0.85
relativeTimeStrFunction · 0.85

Tested by

no test coverage detected