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 idStyle := lipgloss.NewStyle().Width(idLen).MarginRight(1).Foreground(lipgloss.ANSIColor(cyan))
40 statusStyle := lipgloss.NewStyle().Width(statusLen).MarginRight(2).Foreground(lipgloss.ANSIColor(yellow))
41 titleStyle := lipgloss.NewStyle().MarginRight(6).Foreground(lipgloss.ANSIColor(gray))
42 authorStyle := lipgloss.NewStyle().MarginRight(1).Foreground(lipgloss.ANSIColor(magenta))
43 commentStyle := lipgloss.NewStyle().Width(commentLen).MarginRight(1).Foreground(lipgloss.ANSIColor(gray)).Align(lipgloss.Right)
44 commentMarker := lipgloss.NewStyle().Width(2).MarginRight(1).Foreground(lipgloss.ANSIColor(gray))
45
46 title, author := titleText, authorText
47 if termenv.DefaultOutput().Profile != termenv.Ascii {
48 title = truncate.StringWithTail(titleText, titleLen, ellipsisIndicator)
49 titleStyle = titleStyle.Width(titleLen)
50 author = truncate.StringWithTail(authorText, authorLen, ellipsisIndicator)
51 authorStyle = authorStyle.Width(authorLen)
52 }
53
54 str := strings.Join(
55 []string{
56 idStyle.Render(idText),
57 statusStyle.Render(statusText),
58 titleStyle.Render(title),
59 authorStyle.Render(author),
60 commentStyle.Render(commentText),
61 commentMarker.Render(commentIndicator),
62 "\n",
63 }, "")
64
65 os.Stderr.Write([]byte(str))
66}