view

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CursorDown

func CursorDown(g *gocui.Gui, v *gocui.View) error

CursorDown moves the cursor down in the currently selected gocui pane, scrolling the screen as needed.

func CursorStep

func CursorStep(g *gocui.Gui, v *gocui.View, step int) error

Moves the cursor the given step distance, setting the origin to the new cursor line

func CursorUp

func CursorUp(g *gocui.Gui, v *gocui.View) error

CursorUp moves the cursor up in the currently selected gocui pane, scrolling the screen as needed.

Types

type Debug

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

Debug is just for me :)

func (*Debug) IsVisible

func (v *Debug) IsVisible() bool

IsVisible indicates if the status view pane is currently initialized.

func (*Debug) Layout

func (v *Debug) Layout(g *gocui.Gui, minX, minY, maxX, maxY int) error

func (*Debug) Name

func (v *Debug) Name() string

func (*Debug) OnLayoutChange

func (v *Debug) OnLayoutChange() error

OnLayoutChange is called whenever the screen dimensions are changed

func (*Debug) Render

func (v *Debug) Render() error

Render flushes the state objects to the screen.

func (*Debug) RequestedSize

func (v *Debug) RequestedSize(available int) *int

func (*Debug) SetCurrentView

func (v *Debug) SetCurrentView(r Helper)

func (*Debug) Setup

func (v *Debug) Setup(view *gocui.View, header *gocui.View) error

Setup initializes the UI concerns within the context of a global gocui view object.

func (*Debug) Update

func (v *Debug) Update() error

Update refreshes the state objects for future rendering (currently does nothing).

type FileTree

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

FileTree holds the UI objects and data models for populating the right pane. Specifically the pane that shows selected layer or aggregate file ASCII tree.

func (*FileTree) AddViewOptionChangeListener

func (v *FileTree) AddViewOptionChangeListener(listener ...ViewOptionChangeListener)

func (*FileTree) CursorDown

func (v *FileTree) CursorDown() error

CursorDown moves the cursor down and renders the view. Note: we cannot use the gocui buffer since any state change requires writing the entire tree to the buffer. Instead we are keeping an upper and lower bounds of the tree string to render and only flushing this range into the view buffer. This is much faster when tree sizes are large.

func (*FileTree) CursorLeft

func (v *FileTree) CursorLeft() error

CursorLeft moves the cursor up until we reach the Parent Node or top of the tree

func (*FileTree) CursorRight

func (v *FileTree) CursorRight() error

CursorRight descends into directory expanding it if needed

func (*FileTree) CursorUp

func (v *FileTree) CursorUp() error

CursorUp moves the cursor up and renders the view. Note: we cannot use the gocui buffer since any state change requires writing the entire tree to the buffer. Instead we are keeping an upper and lower bounds of the tree string to render and only flushing this range into the view buffer. This is much faster when tree sizes are large.

func (*FileTree) IsVisible

func (v *FileTree) IsVisible() bool

IsVisible indicates if the file tree view pane is currently initialized

func (*FileTree) KeyHelp

func (v *FileTree) KeyHelp() string

KeyHelp indicates all the possible actions a user can take while the current pane is selected.

func (*FileTree) Layout

func (v *FileTree) Layout(g *gocui.Gui, minX, minY, maxX, maxY int) error

func (*FileTree) Name

func (v *FileTree) Name() string

func (*FileTree) OnLayoutChange

func (v *FileTree) OnLayoutChange() error

OnLayoutChange is called by the UI framework to inform the view-model of the new screen dimensions

func (*FileTree) PageDown

func (v *FileTree) PageDown() error

PageDown moves to next page putting the cursor on top

func (*FileTree) PageUp

func (v *FileTree) PageUp() error

PageUp moves to previous page putting the cursor on top

func (*FileTree) Render

func (v *FileTree) Render() error

Render flushes the state objects (file tree) to the pane.

func (*FileTree) RequestedSize

func (v *FileTree) RequestedSize(available int) *int

func (*FileTree) SetFilterRegex

func (v *FileTree) SetFilterRegex(filterRegex *regexp.Regexp)

func (*FileTree) SetTitle

func (v *FileTree) SetTitle(title string)

func (*FileTree) SetTree

func (v *FileTree) SetTree(bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop int) error

SetTreeByLayer populates the view model by stacking the indicated image layer file trees.

func (*FileTree) Setup

func (v *FileTree) Setup(view, header *gocui.View) error

Setup initializes the UI concerns within the context of a global gocui view object.

func (*FileTree) Update

func (v *FileTree) Update() error

Update refreshes the state objects for future rendering.

type Filter

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

Filter holds the UI objects and data models for populating the bottom row. Specifically the pane that allows the user to filter the file tree by path.

func (*Filter) AddFilterEditListener

func (v *Filter) AddFilterEditListener(listener ...FilterEditListener)

func (*Filter) Edit

func (v *Filter) Edit(view *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier)

Edit intercepts the key press events in the filer view to update the file view in real time.

func (*Filter) IsVisible

func (v *Filter) IsVisible() bool

IsVisible indicates if the filter view pane is currently initialized

func (*Filter) KeyHelp

func (v *Filter) KeyHelp() string

KeyHelp indicates all the possible actions a user can take while the current pane is selected.

func (*Filter) Layout

func (v *Filter) Layout(g *gocui.Gui, minX, minY, maxX, maxY int) error

func (*Filter) Name

func (v *Filter) Name() string

func (*Filter) OnLayoutChange

func (v *Filter) OnLayoutChange() error

OnLayoutChange is called whenever the screen dimensions are changed

func (*Filter) Render

func (v *Filter) Render() error

Render flushes the state objects to the screen. Currently this is the users path filter input.

func (*Filter) RequestedSize

func (v *Filter) RequestedSize(available int) *int

func (*Filter) Setup

func (v *Filter) Setup(view, header *gocui.View) error

Setup initializes the UI concerns within the context of a global gocui view object.

func (*Filter) ToggleVisible

func (v *Filter) ToggleVisible() error

ToggleFilterView shows/hides the file tree filter pane.

func (*Filter) Update

func (v *Filter) Update() error

Update refreshes the state objects for future rendering (currently does nothing).

type FilterEditListener

type FilterEditListener func(string) error

type Helper

type Helper interface {
	KeyHelp() string
}

type IView

type IView interface {
	Setup(*gocui.View, *gocui.View) error
	Name() string
	IsVisible() bool
}

type ImageDetails

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

func (*ImageDetails) CursorDown

func (v *ImageDetails) CursorDown() error

func (*ImageDetails) CursorUp

func (v *ImageDetails) CursorUp() error

func (*ImageDetails) IsVisible

func (v *ImageDetails) IsVisible() bool

IsVisible indicates if the details view pane is currently initialized.

func (*ImageDetails) KeyHelp

func (v *ImageDetails) KeyHelp() string

KeyHelp indicates all the possible actions a user can take while the current pane is selected (currently does nothing).

func (*ImageDetails) Name

func (v *ImageDetails) Name() string

func (*ImageDetails) OnLayoutChange

func (v *ImageDetails) OnLayoutChange() error

func (*ImageDetails) PageDown

func (v *ImageDetails) PageDown() error

func (*ImageDetails) PageUp

func (v *ImageDetails) PageUp() error

func (*ImageDetails) Render

func (v *ImageDetails) Render() error

Render flushes the state objects to the screen. The details pane reports: 1. the image efficiency score 2. the estimated wasted image space 3. a list of inefficient file allocations

func (*ImageDetails) Setup

func (v *ImageDetails) Setup(body, header *gocui.View) error

func (*ImageDetails) Update

func (v *ImageDetails) Update() error

Update refreshes the state objects for future rendering.

type Layer

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

Layer holds the UI objects and data models for populating the lower-left pane. Specifically the pane that shows the image layers and layer selector.

func (*Layer) AddLayerChangeListener

func (v *Layer) AddLayerChangeListener(listener ...LayerChangeListener)

func (*Layer) CompareMode

func (v *Layer) CompareMode() viewmodel.LayerCompareMode

func (*Layer) ConstrainLayout

func (v *Layer) ConstrainLayout()

func (*Layer) CurrentLayer

func (v *Layer) CurrentLayer() *image.Layer

CurrentLayer returns the Layer object currently selected.

func (*Layer) CursorDown

func (v *Layer) CursorDown() error

CursorDown moves the cursor down in the layer pane (selecting a higher layer).

func (*Layer) CursorUp

func (v *Layer) CursorUp() error

CursorUp moves the cursor up in the layer pane (selecting a lower layer).

func (*Layer) ExpandLayout

func (v *Layer) ExpandLayout()

func (*Layer) IsVisible

func (v *Layer) IsVisible() bool

IsVisible indicates if the layer view pane is currently initialized.

func (*Layer) KeyHelp

func (v *Layer) KeyHelp() string

KeyHelp indicates all the possible actions a user can take while the current pane is selected.

func (*Layer) LayerCount

func (v *Layer) LayerCount() int

func (*Layer) Name

func (v *Layer) Name() string

func (*Layer) OnLayoutChange

func (v *Layer) OnLayoutChange() error

OnLayoutChange is called whenever the screen dimensions are changed

func (*Layer) PageDown

func (v *Layer) PageDown() error

PageDown moves to next page putting the cursor on top

func (*Layer) PageUp

func (v *Layer) PageUp() error

PageUp moves to previous page putting the cursor on top

func (*Layer) Render

func (v *Layer) Render() error

Render flushes the state objects to the screen. The layers pane reports: 1. the layers of the image + metadata 2. the current selected image

func (*Layer) SetCursor

func (v *Layer) SetCursor(layer int) error

SetCursor resets the cursor and orients the file tree view based on the given layer index.

func (*Layer) Setup

func (v *Layer) Setup(body *gocui.View, header *gocui.View) error

Setup initializes the UI concerns within the context of a global gocui view object.

func (*Layer) Update

func (v *Layer) Update() error

Update refreshes the state objects for future rendering (currently does nothing).

type LayerChangeListener

type LayerChangeListener func(viewmodel.LayerSelection) error

type LayerDetails

type LayerDetails struct {
	CurrentLayer *image.Layer
	// contains filtered or unexported fields
}

func (*LayerDetails) CursorDown

func (v *LayerDetails) CursorDown() error

CursorDown moves the cursor up in the details pane

func (*LayerDetails) CursorUp

func (v *LayerDetails) CursorUp() error

CursorUp moves the cursor up in the details pane

func (*LayerDetails) IsVisible

func (v *LayerDetails) IsVisible() bool

IsVisible indicates if the details view pane is currently initialized.

func (*LayerDetails) KeyHelp

func (v *LayerDetails) KeyHelp() string

KeyHelp indicates all the possible actions a user can take while the current pane is selected (currently does nothing).

func (*LayerDetails) Name

func (v *LayerDetails) Name() string

func (*LayerDetails) OnLayoutChange

func (v *LayerDetails) OnLayoutChange() error

func (*LayerDetails) Render

func (v *LayerDetails) Render() error

Render flushes the state objects to the screen. The details pane reports the currently selected layer's: 1. tags 2. ID 3. digest 4. command

func (*LayerDetails) SetCursor

func (v *LayerDetails) SetCursor(x, y int) error

func (*LayerDetails) Setup

func (v *LayerDetails) Setup(body, header *gocui.View) error

func (*LayerDetails) Update

func (v *LayerDetails) Update() error

Update refreshes the state objects for future rendering.

type Renderer

type Renderer interface {
	Update() error
	Render() error
	IsVisible() bool
}

Controller defines the a renderable terminal screen pane.

type Status

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

Status holds the UI objects and data models for populating the bottom-most pane. Specifically the panel shows the user a set of possible actions to take in the window and currently selected pane.

func (*Status) AddHelpKeys

func (v *Status) AddHelpKeys(keys ...*key.Binding)

func (*Status) IsVisible

func (v *Status) IsVisible() bool

IsVisible indicates if the status view pane is currently initialized.

func (*Status) KeyHelp

func (v *Status) KeyHelp() string

KeyHelp indicates all the possible global actions a user can take when any pane is selected.

func (*Status) Layout

func (v *Status) Layout(g *gocui.Gui, minX, minY, maxX, maxY int) error

func (*Status) Name

func (v *Status) Name() string

func (*Status) OnLayoutChange

func (v *Status) OnLayoutChange() error

OnLayoutChange is called whenever the screen dimensions are changed

func (*Status) Render

func (v *Status) Render() error

Render flushes the state objects to the screen.

func (*Status) RequestedSize

func (v *Status) RequestedSize(available int) *int

func (*Status) SetCurrentView

func (v *Status) SetCurrentView(r Helper)

func (*Status) Setup

func (v *Status) Setup(view *gocui.View) error

Setup initializes the UI concerns within the context of a global gocui view object.

func (*Status) Update

func (v *Status) Update() error

Update refreshes the state objects for future rendering (currently does nothing).

type ViewOptionChangeListener

type ViewOptionChangeListener func() error

type Views

type Views struct {
	Tree         *FileTree
	Layer        *Layer
	Status       *Status
	Filter       *Filter
	LayerDetails *LayerDetails
	ImageDetails *ImageDetails
	Debug        *Debug
}

func NewViews

func NewViews(g *gocui.Gui, imageName string, analysis *image.AnalysisResult, cache filetree.Comparer) (*Views, error)

func (*Views) All

func (views *Views) All() []Renderer

Jump to

Keyboard shortcuts

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