startupview

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package startupview renders the report a Nimbus app prints when it boots.

It lives apart from the App because two different processes need to draw it. A direct `go run .` renders the view itself. Under `nimbus serve` the app is a child of Air with a pipe for stdout — it can neither colour its output nor know when the CLI is ready for it — so it emits the same facts as a single-line marker and the CLI, which does own a terminal, renders them. One renderer, one look, however the app was started.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorEnabled

func ColorEnabled() bool

ColorEnabled reports whether this process will colour the view.

func DescribeDSN

func DescribeDSN(dsn string) string

DescribeDSN reduces a connection string to something safe to print: a file path stays as it is, a URL keeps only host and database, and credentials never appear.

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration renders a boot duration the way it is talked about.

func IsMarker

func IsMarker(line string) bool

IsMarker reports whether a line of app output carries a boot report.

func LANAddress

func LANAddress() string

LANAddress finds the machine's address on the local network, so the URL can be opened from a phone or another machine.

func Render

func Render(i Info) string

Render draws the full boot report.

func RenderLaunch

func RenderLaunch(l Launch) string

RenderLaunch draws the line shown the moment `nimbus serve` starts.

It exists because the boot report cannot: that one needs a running app, and between the command being typed and the app being up there is a compile, an asset build and — in a real project — schema migrations. That gap was silent, which reads as a hang rather than as work in progress. This says what is happening immediately, and the boot report replaces it when the app is actually serving.

Types

type Info

type Info struct {
	Name    string `json:"name"`
	Env     string `json:"env"`
	Version string `json:"version"`
	Go      string `json:"go"`
	OS      string `json:"os"`
	Arch    string `json:"arch"`

	Scheme string `json:"scheme"`
	Port   string `json:"port"`
	LAN    string `json:"lan,omitempty"`

	DBDriver string `json:"db_driver,omitempty"`
	DBSource string `json:"db_source,omitempty"`

	Providers int `json:"providers"`
	Plugins   int `json:"plugins"`

	Routes       int           `json:"routes"`
	RouteCompile time.Duration `json:"route_compile"`

	ViewExt        string `json:"view_ext,omitempty"`
	ViewLiveReload bool   `json:"view_live_reload,omitempty"`

	Booted   time.Duration `json:"booted"`
	Watching bool          `json:"watching,omitempty"`
}

Info is everything the boot report shows. It crosses a process boundary as JSON, so every field is exported and tagged.

func ParseMarker

func ParseMarker(line string) (Info, bool)

ParseMarker decodes a marker line. It also understands the pipe-delimited form emitted by apps built against nimbus ≤ v1.5.4, so a new CLI in front of an older app still shows something sensible rather than a raw marker.

func (Info) Marker

func (i Info) Marker() string

Marker encodes the view for a process that cannot draw it.

type Launch

type Launch struct {
	// Inertia reports a frontend dev server running alongside.
	Inertia bool
	// Watching lists what triggers a rebuild.
	Watching string
}

Launch is what `nimbus serve` knows before the app exists: the command has just been typed and nothing has compiled yet.

Jump to

Keyboard shortcuts

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