1package main
2
3import (
4 "os"
5 "strings"
6
7 "github.com/charmbracelet/lipgloss"
8 "github.com/muesli/reflow/truncate"
9 "github.com/muesli/termenv"
10)
11
12func main() {
13 const (
14 idText = "9f3e262"
15 statusText = "closed"
16 titleText = "Error: the repository you want to access is already locked"
17 labelIndicator = "◼"
18 authorText = "Arnaud LE CAM (arnaudlecam)"
19 commentText = "9"
20 commentIndicator = "💬"
21 ellipsisIndicator = "…"
22 )
23
24 const (
25 cyan = termenv.ANSICyan
26 yellow = termenv.ANSIYellow
27 magenta = termenv.ANSIMagenta
28 gray = termenv.ANSIWhite
29 )
30
31 const (
32 idLen = 7
33 statusLen = len("closed")
34 titleLen = 50
35 authorLen = 15
36 commentLen = 3
37 )
38
39 title, author := titleText, authorText
40 if termenv.DefaultOutput().Profile != termenv.Ascii {
41 title = truncate.StringWithTail(titleText, titleLen, ellipsisIndicator)
42 author = truncate.StringWithTail(authorText, authorLen, ellipsisIndicator)
43 }
44
45 idStyle := lipgloss.NewStyle().Width(idLen).MarginRight(1).Foreground(lipgloss.ANSIColor(cyan))
46 statusStyle := lipgloss.NewStyle().Width(statusLen).MarginRight(2).Foreground(lipgloss.ANSIColor(yellow))
47 titleStyle := lipgloss.NewStyle().Width(titleLen).MarginRight(6).Foreground(lipgloss.ANSIColor(gray))
48 authorStyle := lipgloss.NewStyle().Width(authorLen).MarginRight(1).Foreground(lipgloss.ANSIColor(magenta))
49 commentStyle := lipgloss.NewStyle().Width(commentLen).MarginRight(1).Foreground(lipgloss.ANSIColor(gray)).Align(lipgloss.Right)
50 commentMarker := lipgloss.NewStyle().Width(2).MarginRight(1).Foreground(lipgloss.ANSIColor(gray))
51
52 str := strings.Join(
53 []string{
54 idStyle.Render(idText),
55 statusStyle.Render(statusText),
56 titleStyle.Render(title),
57 authorStyle.Render(author),
58 commentStyle.Render(commentText),
59 commentMarker.Render(commentIndicator),
60 "\n",
61 }, "")
62
63 os.Stderr.Write([]byte(str))
64}