Documentation
¶
Overview ¶
Package ui implements sou's terminal interface.
The package is organised as an application shell (header, tab strip, status bar) drawn around one of a small number of views: the layer list, the file browser and a text pager used for file previews, the image manifest and the image config. Domain logic lives in the container package; everything here is presentation and interaction.
Index ¶
- func AbsoluteTime(t time.Time) string
- func CommandVerb(formatted string) string
- func DisplayPath(p string) string
- func FormatCommand(cmd string) string
- func FormatCount(n int) string
- func FormatSize(size int64) string
- func Pluralize(n int, singular, plural string) string
- func RelativeTime(t time.Time) string
- func ShortDigest(digest string, n int) string
- type Density
- type Layout
- type Mode
- type Model
- type Whiteout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsoluteTime ¶
AbsoluteTime renders a timestamp for detail panels, or an empty string when the image did not record one.
func CommandVerb ¶
CommandVerb returns the leading instruction of a formatted command (RUN, COPY, ENV, ...) so it can be colour-coded, or an empty string when the entry does not start with one.
func DisplayPath ¶
DisplayPath renders a browser path as an absolute path.
func FormatCommand ¶
FormatCommand turns a raw history entry into something readable.
Build tooling wraps every instruction in shell boilerplate: BuildKit appends "# buildkit", the classic builder prefixes metadata-only instructions with "/bin/sh -c #(nop)" and shell instructions with "/bin/sh -c". Stripping that noise is what makes the layer list scannable.
func FormatCount ¶
FormatCount renders a cardinal number with thousands separators.
func FormatSize ¶
FormatSize renders a byte count the way a developer reads it: three significant figures and a familiar unit.
func RelativeTime ¶
RelativeTime renders a timestamp as an approximate age. It returns an empty string for the zero time, which container images use for "unknown".
func ShortDigest ¶
ShortDigest shortens a "sha256:abcdef..." digest for narrow contexts.
Types ¶
type Density ¶
type Density int
Density selects the amount of information a row can show. It is resolved per pane rather than per frame, because a pane can be much narrower than the terminal it sits in.
type Layout ¶
type Layout struct {
Width int
Height int
ShowTabs bool
ShowBottomRule bool
// ContentTop is the zero-based screen row the main content starts on.
ContentTop int
ContentHeight int
ContentWidth int
}
Layout is the resolved geometry of one frame. It is computed by a pure function from the terminal size alone, which keeps rendering, hit testing for the mouse and the layout tests all working from the same numbers.
func ComputeLayout ¶
ComputeLayout resolves the frame geometry for a terminal of w x h cells.
func (Layout) RowToIndex ¶
RowToIndex maps a screen row to an index in a scrolled list, reporting ok=false when the row falls outside the content area. It is what makes mouse clicks land on the right item.
type Mode ¶
type Mode int
Mode is the screen currently in front of the user.
const ( // LayerMode lists the layers of the image. LayerMode Mode = iota // FileMode browses the filesystem of one extracted layer. FileMode // ViewMode shows the contents of a single file. ViewMode // LoadingMode covers layer extraction, which reports progress. LoadingMode // ManifestMode shows the image manifest. ManifestMode // ConfigMode shows the image config. ConfigMode // PullingMode covers resolving and, if needed, pulling the image. PullingMode // ErrorMode is the terminal state after the image could not be loaded. ErrorMode )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model.
func NewModel ¶
NewModel builds the root model for an image reference.
The returned command performs the initial image load. It is also returned by Init, whichever runs first; callers that drive the model by hand can use the returned command instead of calling Init.
type Whiteout ¶
type Whiteout struct {
// Name is the path the marker deletes.
Name string
// Opaque marks a directory whose entire previous content is hidden.
Opaque bool
}
Whiteout describes an overlay filesystem deletion marker.
func ParseWhiteout ¶
ParseWhiteout recognises the overlayfs deletion markers that appear inside image layers, so that the browser can present them as deletions rather than as oddly named files.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package components holds the reusable presentation primitives of the sou interface: text measurement and fitting helpers, the application shell (header, tab strip, status bar), and the standard empty, error and loading states.
|
Package components holds the reusable presentation primitives of the sou interface: text measurement and fitting helpers, the application shell (header, tab strip, status bar), and the standard empty, error and loading states. |
|
Package theme holds sou's design system: a semantic colour palette, the glyph set used to draw the interface and the pre-built lipgloss styles that every view renders through.
|
Package theme holds sou's design system: a semantic colour palette, the glyph set used to draw the interface and the pre-built lipgloss styles that every view renders through. |