Documentation
¶
Overview ¶
Package ui assembles the terminal interface.
The rule this package follows is that widgets never hold application state. Anything a decision depends on — the current statement, the result buffer — lives outside tview, so it can be tested without a terminal. Widgets only render what they are handed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Launch ¶ added in v0.9.0
func Launch(deps LaunchDeps) (*session.Session, error)
Launch shows the datasource list on its own and returns the session the user connected to, or nil when they closed the list instead.
It is its own small application rather than a state of App because App assumes a connection in nearly every method; a launcher that ends by handing over a session keeps that assumption true.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the running interface for one datasource.
func New ¶
New builds the interface for an open session.
The session rather than the connection, because switching datasource has to close what it left — and a tunnel closed by nobody outlives the thing it was carrying.
type Deps ¶
type Deps struct {
Cache *catalog.Cache
History *history.Store
// Connect opens another datasource, for switching mid-session. Nil leaves
// the session on the datasource it started with, and the switch says so
// rather than failing silently.
Connect func(context.Context, *config.DataSource) (*session.Session, error)
// ConfigPath is where the datasource dialog saves. Empty means a save
// from the dialog is refused, with a message saying why; connecting
// still works.
ConfigPath string
// Secrets stores passwords typed into the dialog. Nil means they cannot
// be stored here, which the form says instead of pretending.
Secrets secret.Store
// Probe answers the dialog's Test button.
Probe func(ctx context.Context, ds *config.DataSource, password string) (string, error)
}
Deps are the optional collaborators an interface can be given.
They are optional so that the interface still opens when the cache cannot be created — a read-only home directory should cost the user completion, not the whole application.
type LaunchDeps ¶ added in v0.9.0
type LaunchDeps struct {
Config *config.Config
ConfigPath string
Secrets secret.Store
Probe func(ctx context.Context, ds *config.DataSource, password string) (string, error)
Connect func(ctx context.Context, ds *config.DataSource) (*session.Session, error)
// Screen replaces the terminal, for tests. Nil is the real one.
Screen tcell.Screen
}
LaunchDeps is what the datasource list needs before there is a session.
Source Files
¶
- affordance.go
- app.go
- completion.go
- confirm.go
- copyresult.go
- cursor.go
- datasource.go
- dialog.go
- dsform.go
- dspicker.go
- edit.go
- editor.go
- fitted.go
- grid.go
- gridcopy.go
- history.go
- launch.go
- motion.go
- mouse.go
- panel.go
- platform.go
- preview.go
- reconnect.go
- rowview.go
- rule.go
- saveresult.go
- search.go
- searchbox.go
- spine.go
- status.go
- tables.go
- theme.go
- topbar.go
- transport.go
- tree.go
- treelabel.go
- useschema.go
- zone.go