1package ui
2
3import (
4 "fmt"
5 "strings"
6)
7
8func InsertCursor(line string, selected bool, styles Styles) string {
9 prefix := " "
10 style := styles.Value
11 if selected {
12 prefix = "▶ "
13 style = styles.ActiveCursorPointer
14 }
15 line = prefix + style.Render(line)
16 return line
17}
18
19func InsertCursorRulesSection(line string, selected bool, styles Styles, action string) string {
20 prefix := " "
21
22 if selected {
23 return "▶ " + styles.ActiveCursorPointer.Render(line)
24 }
25
26 policyStyle := GetPolicyStyle(styles, action)
27
28 actionFormatted := fmt.Sprintf("%-6s", action)
29 styledAction := policyStyle.Render(actionFormatted)
30
31 line = strings.Replace(line, actionFormatted, styledAction, 1)
32
33 return prefix + styles.Value.Render(line)
34}