tui

package
v1.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ViewMinHeight = 20 // the minimum internal height the view can be
	ViewVPad      = 1  // the vertical padding of the view

	ViewMinWidth = 60  // the minimum internal width the view can be
	ViewWidthPct = 0.4 // percentage of terminal internal width the main view should occupy
	ViewHPad     = 2   // the horizontal padding of the view
)

View dimensions width / height refers to the internal text area of the view i.e. excluding the border and the padding

Variables

View Source
var (
	ColorPrimary  = lipgloss.Color("#e62129")                         // Red, from the OSV logo :)
	ColorDisabled = lipgloss.AdaptiveColor{Light: "250", Dark: "238"} // Grey
)
View Source
var (
	SelectedTextStyle = lipgloss.NewStyle().Foreground(ColorPrimary)
	DisabledTextStyle = lipgloss.NewStyle().Foreground(ColorDisabled)
)
View Source
var CloseViewModel tea.Cmd = func() tea.Msg { return ViewModelCloseMsg{} }
View Source
var Keys = KeyMap{
	Up: key.NewBinding(
		key.WithKeys("up"),
		key.WithHelp("↑", "move up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down"),
		key.WithHelp("↓", "move down"),
	),
	Left: key.NewBinding(
		key.WithKeys("left"),
	),
	Right: key.NewBinding(
		key.WithKeys("right"),
	),
	Select: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select option"),
	),
	SwitchView: key.NewBinding(
		key.WithKeys("tab", "i"),
		key.WithHelp("i/tab", "switch views"),
	),
	Help: key.NewBinding(
		key.WithKeys("h"),
		key.WithHelp("h", "toggle help"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "esc"),
		key.WithHelp("q/esc", "exit"),
	),
}

Functions

func NewInPlaceInfo

func NewInPlaceInfo(res remediation.InPlaceResult) *inPlaceInfo

func NewRelockInfo

func NewRelockInfo(change resolution.ResolutionDiff) *relockInfo

func NewSpinner

func NewSpinner() spinner.Model

Helper to have all spinners styled consistently

func NewVulnInfo

func NewVulnInfo(vuln *resolution.ResolutionVuln) *vulnInfo

func NewVulnList

func NewVulnList(vulns []*resolution.ResolutionVuln, preamble string) *vulnList

func RenderSelectorOption

func RenderSelectorOption(
	selected bool,
	cursor string,
	format string,
	args ...any,
) string

Inline selector renderer, for layouts that don't fit neatly into a list/table

func RenderSeverity

func RenderSeverity(severities []models.Severity) string

func RenderSeverityShort

func RenderSeverityShort(severities []models.Severity) string

Types

type ChainGraph

type ChainGraph struct {
	// contains filtered or unexported fields
}

func FindChainGraphs

func FindChainGraphs(chains []resolution.DependencyChain) []ChainGraph

for each unique vulnerable node, construct the graph from that node to each connected direct dependency, choosing only the shortest path

func (ChainGraph) String

func (c ChainGraph) String() string

type KeyMap

type KeyMap struct {
	Up         key.Binding
	Down       key.Binding
	Left       key.Binding
	Right      key.Binding
	Select     key.Binding
	SwitchView key.Binding
	Help       key.Binding
	Quit       key.Binding
}

Key bindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

type ViewModel

type ViewModel interface {
	Update(msg tea.Msg) (ViewModel, tea.Cmd)
	View() string
	Resize(w, h int)
}

tea-like model for representing the secondary info panel Allows for resizing

type ViewModelCloseMsg

type ViewModelCloseMsg struct{}

Msg and Cmd to use to quit out of the ViewModel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL