MCPcopy
hub / github.com/cli/cli / statusLine

Function statusLine

pkg/cmd/repo/garden/garden.go:442–462  ·  view source on GitHub ↗
(garden [][]*Cell, player *Player, io *iostreams.IOStreams)

Source from the content-addressed store, hash-verified

440}
441
442func statusLine(garden [][]*Cell, player *Player, io *iostreams.IOStreams) string {
443 width := io.TerminalWidth()
444 statusLines := []string{garden[player.Y][player.X].StatusLine}
445
446 if player.ShoeMoistureContent > 1 {
447 statusLines = append(statusLines, "Your shoes squish with water from the stream.")
448 } else if player.ShoeMoistureContent == 1 {
449 statusLines = append(statusLines, "Your shoes seem to have dried out.")
450 } else {
451 statusLines = append(statusLines, "")
452 }
453
454 for i, line := range statusLines {
455 if len(line) < width {
456 paddingSize := width - len(line)
457 statusLines[i] = line + strings.Repeat(" ", paddingSize)
458 }
459 }
460
461 return strings.Join(statusLines, "\n")
462}
463
464func shaToColorFunc(sha string) func(string) string {
465 return func(c string) string {

Callers 1

gardenRunFunction · 0.85

Calls 2

TerminalWidthMethod · 0.80
JoinMethod · 0.80

Tested by

no test coverage detected