Documentation
¶
Index ¶
- Constants
- Variables
- func BindingHints(r *Runtime, focus string) string
- func Call(ctx context.Context, path string, q Request) (any, error)
- func ComposeModal(background, title, body, footer string, width, height int, styles Styles) string
- func CutKey(key string) (noun, verb string, ok bool)
- func DecodeJSONC(data []byte, v any) error
- func DefaultTones() map[string]ToneStyle
- func FitFocusPath(levels []string, width int) string
- func FormatBindings(doc BindingsDoc) ([]byte, error)
- func FormatRows(rows any) ([]byte, error)
- func FormatRowsJSON(data []byte) ([]byte, error)
- func InputView(in *Input, width, height int) string
- func IntArg(a Arguments, name string, fallback int) int
- func JSONPointer(value any, path string) (any, error)
- func JobsTicker(jobs []JobInfo, width int) []string
- func JoinHints(cells []HintCell) string
- func ListHash(records []string) string
- func MatchModes() []string
- func MatchTag(mode string) string
- func ModalSize(width, height int) (contentWidth, contentHeight int)
- func MotionScroll(want, page int) int
- func Namespaced(namespace, name string) string
- func NextMatch(mode string, step int) string
- func On(b bool) *bool
- func PanelContentSize(width, height int) (int, int)
- func ParseSchemes(data []byte) (map[string]Scheme, []string)
- func RecordHash(line []byte) string
- func RegisterInputOperations(r *Runtime)
- func SegmentSetting(id string) string
- func SortBindings(rows []Binding)
- func SpanInView(from, to, page int) bool
- func SplitKey(key string) (noun, verb string)
- func SplitKeys(keys string) (prefix, final string)
- func StandardVerbs() []string
- func StandardizeJSONC(data []byte) ([]byte, error)
- func StringArg(a Arguments, name, fallback string) string
- func TableText(cols []Column, rows [][]string, width int) []string
- func TextBody(text string) func(int) string
- type Action
- type ActionAlias
- type AliasRow
- type Align
- type AppHandler
- type Appearance
- type ArgumentError
- type Arguments
- type Argv
- type BareReading
- type Binding
- func (b Binding) Captured() Binding
- func (b Binding) FromKey(arg string) Binding
- func (b Binding) FromPayload(arg, source string) Binding
- func (b Binding) FromRow(arg, field string) Binding
- func (b Binding) Guard(name string) Binding
- func (b Binding) Hide() Binding
- func (b Binding) Hinted(text string) Binding
- func (b Binding) Join(arg string, sources ...string) Binding
- type BindingGroup
- type BindingTimeoutMsg
- type BindingsDoc
- type Block
- type CallMsg
- type Card
- type CardRole
- type CardSection
- type CardStep
- type CaseMatch
- type Choice
- type Chooser
- func (c *Chooser) Close()
- func (c *Chooser) HandleMessage(tea.Msg) bool
- func (c *Chooser) Highlighted() (ChooserRow, bool)
- func (c *Chooser) Kind() string
- func (c *Chooser) Loading() bool
- func (c *Chooser) MatchMode() string
- func (c *Chooser) Matches() []ChooserRow
- func (c *Chooser) ModalBlock(_ Styles, width, height int) Block
- func (c *Chooser) ModalTitle() string
- func (c *Chooser) Moved() bool
- func (c *Chooser) PendingCommand() tea.Cmd
- func (c *Chooser) Query() string
- func (c *Chooser) SetQuery(query string)
- func (c *Chooser) SetRows(rows []ChooserRow)
- func (c *Chooser) Source() string
- func (c *Chooser) Sources() []string
- func (c *Chooser) Title() string
- func (c *Chooser) View(width, height int) Block
- type ChooserRow
- type ChooserSource
- type ChooserSpec
- type Column
- type Completer
- func (c *Completer) Close()
- func (c *Completer) DebounceCurrent(msg CompletionDebounceMsg) bool
- func (c *Completer) DebounceTick() (CompletionDebounceMsg, bool)
- func (c *Completer) Err() error
- func (c *Completer) HandleMessage(msg tea.Msg) bool
- func (c *Completer) Highlighted() int
- func (c *Completer) Input() string
- func (c *Completer) Open() bool
- func (c *Completer) PendingCommand() tea.Cmd
- func (c *Completer) Searching() bool
- func (c *Completer) State() map[string]any
- func (c *Completer) Suggestions() []Suggestion
- func (c *Completer) Token() (CompletionToken, bool)
- type Completion
- type CompletionDebounceMsg
- type CompletionQuery
- type CompletionSearch
- type CompletionToken
- type CompletionTrigger
- type Component
- type Config
- func (c *Config) ActionProblems() []string
- func (c *Config) BindingProblems() []string
- func (c *Config) BindingsFormat() string
- func (c *Config) Close()
- func (c *Config) Directory() string
- func (c *Config) Disable()
- func (c *Config) Flush() error
- func (c *Config) FrameworkTheme() bool
- func (c *Config) HandleMessage(tea.Msg) bool
- func (c *Config) HistoryPath() string
- func (c *Config) NounPlacesPath() string
- func (c *Config) PanesPath() string
- func (c *Config) Path(name string) string
- func (c *Config) Paths() ConfigPaths
- func (c *Config) PendingCommand() tea.Cmd
- func (c *Config) Schemes() map[string]Scheme
- func (c *Config) StateDirectory() string
- func (c *Config) TablesPath() string
- type ConfigExport
- type ConfigPaths
- type Context
- type Ctx
- type DefaultBinding
- type Detail
- func (d *Detail) ID() string
- func (d *Detail) Item() string
- func (d *Detail) Marker() string
- func (d *Detail) Offset() int
- func (d *Detail) Overflows() bool
- func (d *Detail) Scroll(lines int) int
- func (d *Detail) Width() int
- func (d *Detail) Window(text string, width, height int) (body, marker string)
- type EditNode
- type FocusTargeter
- type Footer
- type ForegroundExit
- type ForegroundMsg
- type Guard
- type Handler
- type Header
- type HelpCell
- type HelpKey
- type HelpRow
- type HelpStep
- type HintCell
- type HistoryContext
- type HistoryEntry
- type HistoryMove
- type HistoryPlace
- type HistoryResult
- type InfoSinkdeprecated
- type Input
- func (in *Input) Count() int
- func (in *Input) Pending() string
- func (in *Input) Redo(steps, branch int) error
- func (in *Input) Replace(start, end int, text string) error
- func (in *Input) SelectAll() error
- func (in *Input) SelectText(start, end int) error
- func (in *Input) SelectedText() (start, end int, ok bool)
- func (in *Input) Selection() (start, end int, ok bool)
- func (in *Input) SetMode(mode string)
- func (in *Input) SetText(text string)
- func (in *Input) Snapshot() map[string]any
- func (in *Input) Undo(steps int) error
- type Instance
- type InstanceOption
- func CellSelect() InstanceOption
- func ClearFilterOnEnter() InstanceOption
- func CloseOnDetach() InstanceOption
- func Columns(cols ...Column) InstanceOption
- func Completions(triggers ...CompletionTrigger) InstanceOption
- func DefaultHidden() InstanceOption
- func Focus(id string) InstanceOption
- func FocusOnClose(id string) InstanceOption
- func FollowTail() InstanceOption
- func HeaderLines(n int) InstanceOption
- func Kind(noun string) InstanceOption
- func NoMarks() InstanceOption
- func NoSpill() InstanceOption
- func Parent(id string) InstanceOption
- func ParentStop(id string) InstanceOption
- func ReadOnly() InstanceOption
- func RowSelect() InstanceOptiondeprecated
- func SpillToSelection() InstanceOption
- type Invocation
- type JobInfo
- type JobLingerMsg
- type KeyEchoCell
- type KeyEvent
- type KeyOutcome
- type Layout
- func (l Layout) BodySize() (width, height int)
- func (l Layout) BodySizeWith(f Footer) (width, height int)
- func (l Layout) Divide(first, total, least int) int
- func (l Layout) HeaderRule(cells []SegmentCell, width int) string
- func (l Layout) Page(title, subtitle, body, footer string) string
- func (l Layout) PageBlock(title, subtitle string, body Block, footer string) Block
- func (l Layout) Panel(title, body string, width, height int, focused bool) string
- func (l Layout) PanelBlock(title string, body Block, width, height int, focused bool) Block
- func (l Layout) Shell(h Header, body Block, f Footer) Block
- func (l Layout) Sidebar(title string, items []string, selected int, mainTitle, mainBody string) string
- func (l Layout) SidebarBlock(title string, items []string, selected int, mainTitle string, mainBody Block) Block
- func (l Layout) Split(leftTitle, leftBody, rightTitle, rightBody string) string
- func (l Layout) SplitBlock(leftTitle string, leftBody Block, rightTitle string, rightBody Block) Block
- func (l Layout) SplitFocusBlock(focused SplitSide, leftTitle string, leftBody Block, rightTitle string, ...) Block
- func (l Layout) TickerRule(jobs []string, width int) string
- func (l Layout) WithPanelTone(tone string) Layout
- type LineScroller
- type Lines
- type List
- func (l *List) CanScrollLines() bool
- func (l *List) Column() int
- func (l *List) ColumnOffset() int
- func (l *List) ColumnWidths() map[int]int
- func (l *List) Columns() []Column
- func (l *List) EndVisual()
- func (l *List) Filter() string
- func (l *List) Filtering() bool
- func (l *List) Focus() error
- func (l *List) FocusTarget() string
- func (l *List) Focused() bool
- func (l *List) Height() int
- func (l *List) Items() []ListItem
- func (l *List) Len() int
- func (l *List) Marked() []ListItem
- func (l *List) MatchMode() string
- func (l *List) ModeChanged(from, to string)
- func (l *List) Move(delta int)
- func (l *List) Patch(p ListPatch) error
- func (l *List) PinColumn(i int)
- func (l *List) PinnedColumns() []int
- func (l *List) ResetColumnWidths()
- func (l *List) ResetPins()
- func (l *List) ScrollLines(lines int)
- func (l *List) Select(id string) error
- func (l *List) Selected() (ListItem, bool)
- func (l *List) SetColumn(i int)
- func (l *List) SetColumnWidth(i, width int)
- func (l *List) SetColumns(cols ...Column)
- func (l *List) SetFilter(query string)
- func (l *List) SetItems(items []ListItem) error
- func (l *List) SetPinnedColumns(pins []int)
- func (l *List) Shown() int
- func (l *List) Snapshot() map[string]any
- func (l *List) StartVisual() error
- func (l *List) ToggleMark(id string) error
- func (l *List) UnpinColumn(i int)
- func (l *List) UnpinColumns()
- func (l *List) View(width, height int) string
- func (l *List) Visual() bool
- type ListItem
- type ListPatch
- type ListQuery
- type MacroKey
- type MacroState
- type Matcher
- func (m Matcher) Err() error
- func (m Matcher) Fold() bool
- func (m Matcher) Match(text string) bool
- func (m Matcher) MatchPrepared(hay string) bool
- func (m Matcher) Mode() string
- func (m Matcher) Prepare(text string) string
- func (m Matcher) Scattered() bool
- func (m Matcher) ScorePrepared(hay string) (int, bool)
- type ModalBody
- type ModalOption
- type ModalView
- type ModeBuilder
- func (m *ModeBuilder) Bind(keys string, row Binding) *ModeBuilder
- func (m *ModeBuilder) Extends(parent string) *ModeBuilder
- func (m *ModeBuilder) Pattern(pattern string, row Binding) *ModeBuilder
- func (m *ModeBuilder) Unbind(keysOrPattern string) *ModeBuilder
- func (m *ModeBuilder) UnbindGuarded(keysOrPattern, guard string) *ModeBuilder
- func (m *ModeBuilder) When(guard string) *ModeBuilder
- type ModeObserver
- type ModeOption
- type ModeSpec
- type ModeState
- type Model
- func (m *Model) Init() tea.Cmd
- func (m *Model) JobLingerTick() (JobLingerMsg, bool)
- func (m *Model) JobsTicker(width int) []string
- func (m *Model) KeyEchoLabels() []string
- func (m *Model) Notify(text string) NoticeID
- func (m *Model) SegmentTick() (SegmentTickMsg, bool)
- func (m *Model) SegmentsInFlight() int
- func (m *Model) StatusSegments() []string
- func (m *Model) Styles() Styles
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() tea.View
- type NoticeID
- type Noun
- type NounAlias
- type NounBuilder
- func (b *NounBuilder) Action(key string, h Handler) *NounBuilder
- func (b *NounBuilder) Alias(verbs ...string) *NounBuilder
- func (b *NounBuilder) AliasOn(noun, verb string) *NounBuilder
- func (b *NounBuilder) Columns(cols ...Column) *NounBuilder
- func (b *NounBuilder) Completions(triggers ...CompletionTrigger) *NounBuilder
- func (b *NounBuilder) Confirm(prompt string) *NounBuilder
- func (b *NounBuilder) Fetch() *NounBuilder
- func (b *NounBuilder) Focusable() *NounBuilder
- func (b *NounBuilder) Many() *NounBuilder
- func (b *NounBuilder) Mode(mode string) *ModeBuilder
- func (b *NounBuilder) Motion() *NounBuilder
- func (b *NounBuilder) Noun() *Noun
- func (b *NounBuilder) PersistArgs() *NounBuilder
- func (b *NounBuilder) Pin(mode string) *NounBuilder
- func (b *NounBuilder) Positional(names ...string) *NounBuilder
- func (b *NounBuilder) Props(props ...PropSpec) *NounBuilder
- func (b *NounBuilder) Quiet() *NounBuilder
- func (b *NounBuilder) Region() *NounBuilder
- func (b *NounBuilder) Renamed(old, since, removeAfter string) *NounBuilder
- func (b *NounBuilder) Rows(noun string) *NounBuilder
- func (b *NounBuilder) State() *NounBuilder
- func (b *NounBuilder) Store(s Store) *NounBuilder
- func (b *NounBuilder) TextResult() *NounBuilder
- func (b *NounBuilder) Verb(verb string, h any, description ...string) *NounBuilder
- func (b *NounBuilder) Verbs(verbs ...string) *NounBuilder
- func (b *NounBuilder) When(guard string) *NounBuilder
- type NounPlace
- type NounWord
- type Operation
- type Origin
- type OverlayMark
- type Page
- type Palette
- func (p *Palette) Close()
- func (p *Palette) HandleKey(key string) (bool, error)
- func (p *Palette) IsActive() bool
- func (p *Palette) IsOpen() bool
- func (p *Palette) Open() error
- func (p *Palette) RegisterNoun(noun string, config PaletteNoun) error
- func (p *Palette) Text() string
- func (p *Palette) View() string
- func (p *Palette) ViewSized(width, height int) string
- type PaletteEntry
- type PaletteInstance
- type PaletteNoun
- type PaletteSource
- type PaletteWord
- type ParamAlias
- type Parameter
- type PathChooserSpec
- type PathPick
- type Payload
- type Picker
- type PickerEntry
- type Placement
- type Pos
- type Predicate
- func AllOf(of ...Predicate) Predicate
- func AnyOf(of ...Predicate) Predicate
- func ByID(id string) Predicate
- func ByKind(kind string) Predicate
- func ByNoun(noun string) Predicate
- func ChildOf(id string) Predicate
- func InState(mode string) Predicate
- func IsFocusable() Predicate
- func IsRegion() Predicate
- func Not(of ...Predicate) Predicate
- func ParsePredicates(v any) ([]Predicate, error)
- func Where(name, arg string) Predicate
- func Within(id string) Predicate
- type PredicateFunc
- type PropSpec
- type QueryMatch
- type Record
- type RecordDebounceMsg
- type RecordEditor
- func (e *RecordEditor) Block(width, height int) Block
- func (e *RecordEditor) Close()
- func (e *RecordEditor) Closed() bool
- func (e *RecordEditor) DebounceCurrent(tick RecordDebounceMsg) bool
- func (e *RecordEditor) DebounceTick() (RecordDebounceMsg, bool)
- func (e *RecordEditor) Failure() error
- func (e *RecordEditor) Flush() error
- func (e *RecordEditor) Focus() error
- func (e *RecordEditor) FocusTarget() string
- func (e *RecordEditor) HandleMessage(msg tea.Msg) bool
- func (e *RecordEditor) ID() string
- func (e *RecordEditor) Leave() error
- func (e *RecordEditor) ModalBlock(s Styles, width, height int) Block
- func (e *RecordEditor) ModalTitle() string
- func (e *RecordEditor) PendingCommand() tea.Cmd
- func (e *RecordEditor) Problem(name string) string
- func (e *RecordEditor) Ran() bool
- func (e *RecordEditor) Reload() error
- func (e *RecordEditor) Runnable() bool
- func (e *RecordEditor) Values() Record
- func (e *RecordEditor) WriteError() string
- func (e *RecordEditor) Written() Record
- type RecordField
- type RecordSpec
- type RecordWrite
- type RecordingSink
- func (s *RecordingSink) ClearNotice(id NoticeID)
- func (s *RecordingSink) Info(text string)
- func (s *RecordingSink) LastError() string
- func (s *RecordingSink) LastInfo() string
- func (s *RecordingSink) LastStatus() stringdeprecated
- func (s *RecordingSink) Messages() []UIMessage
- func (s *RecordingSink) Notices() []string
- func (s *RecordingSink) Notify(id NoticeID, text string)
- func (s *RecordingSink) Status(text string)
- type Register
- type Registers
- type Request
- type Response
- type Result
- type Runtime
- func (r *Runtime) Accepts(t Ticket) bool
- func (r *Runtime) ActionAlias(name string) (ActionAlias, bool)
- func (r *Runtime) ActionAliasProblems() []string
- func (r *Runtime) ActionAliases() []ActionAlias
- func (r *Runtime) ActionFor(focus, key string) Handler
- func (r *Runtime) AddActionAlias(a ActionAlias) error
- func (r *Runtime) AddDetail(id string, item func() string, opts ...InstanceOption) (*Detail, error)
- func (r *Runtime) AddInput(in *Input, opts ...InstanceOption) error
- func (r *Runtime) AddList(id string, items []ListItem, opts ...InstanceOption) (*List, error)
- func (r *Runtime) AddNounAlias(a NounAlias) error
- func (r *Runtime) AddPage(id, title string, render func(*Runtime, int, int) Block, ...) (*Page, error)
- func (r *Runtime) AddPathSource(name string, fn func(PathPick) (ChooserSource, bool))
- func (r *Runtime) AddRecordEditor(id string, spec RecordSpec, opts ...InstanceOption) (*RecordEditor, error)
- func (r *Runtime) AddSegment(rows ...Segment) error
- func (r *Runtime) AddSettingsPage() (*Page, error)
- func (r *Runtime) AddTerminal(id string, stream TerminalStream, opts ...InstanceOption) (*Terminal, error)
- func (r *Runtime) AddTimeline(id string, cards []Card, opts ...InstanceOption) (*Timeline, error)
- func (r *Runtime) AddTree(id string, nodes []TreeNode, opts ...InstanceOption) (*Tree, error)
- func (r *Runtime) AddVerbAvailability(key, guard string) error
- func (r *Runtime) AddVerbCheck(key string, check VerbCheck) error
- func (r *Runtime) Alias(alias, noun string) error
- func (r *Runtime) AliasAction(alias, action string) error
- func (r *Runtime) AliasOf(noun string) string
- func (r *Runtime) AliasShadow() string
- func (r *Runtime) Aliases() []NounAlias
- func (r *Runtime) AliasesOf(name string) []ActionAlias
- func (r *Runtime) Ancestry(id string) []string
- func (r *Runtime) Available(q Request, focus string, mode ModeState) bool
- func (r *Runtime) BaseFocus() string
- func (r *Runtime) BaseMode() string
- func (r *Runtime) BeforeQuit(name string, check func(r *Runtime, c Context) Verdict) error
- func (r *Runtime) Bind(rows ...Binding) error
- func (r *Runtime) BindingDebts() []string
- func (r *Runtime) BindingTimeoutCommand() tea.Cmd
- func (r *Runtime) BindingTimeoutTick() (BindingTimeoutMsg, bool)
- func (r *Runtime) BindingsDoc() BindingsDoc
- func (r *Runtime) Builtin(register func())
- func (r *Runtime) CancelPendingBinding()
- func (r *Runtime) CanonicalKey(key string) string
- func (r *Runtime) CanonicalNoun(name string) string
- func (r *Runtime) CanonicalRequest(q Request) Request
- func (r *Runtime) CaseFor(query string) CaseMatch
- func (r *Runtime) Catalog() []Operation
- func (r *Runtime) Changed(nouns ...string)
- func (r *Runtime) CheckDefaultBindings(source string, data []byte) []string
- func (r *Runtime) CheckUserActions() []string
- func (r *Runtime) CheckUserBindings() []string
- func (r *Runtime) Children(id string) []*Instance
- func (r *Runtime) Choices(c Context, p Parameter) ([]Choice, error)
- func (r *Runtime) ChoicesFor(c Context, p Parameter, query string) ([]Choice, error)
- func (r *Runtime) ChoicesSource(p Parameter) string
- func (r *Runtime) ChoicesTakeQuery(p Parameter) bool
- func (r *Runtime) Chooser(kind string) *Chooser
- func (r *Runtime) ChooserLastSource(kind string) string
- func (r *Runtime) ChooserMatch() string
- func (r *Runtime) ChromeLevel() string
- func (r *Runtime) Completer() *Completer
- func (r *Runtime) CompletionTriggers(id string) []CompletionTrigger
- func (r *Runtime) Config() *Config
- func (r *Runtime) Context() Context
- func (r *Runtime) DeclareSetting(settings ...Setting) error
- func (r *Runtime) DeclareSettingOwner(owners ...SettingOwner) error
- func (r *Runtime) DeclareSettingSection(sections ...SettingSection) error
- func (r *Runtime) DefaultBindings() []DefaultBinding
- func (r *Runtime) DefaultBindingsDoc() BindingsDoc
- func (r *Runtime) Define(name string) *NounBuilder
- func (r *Runtime) DefineGuard(name string, fn Guard)
- func (r *Runtime) DefineMode(name string, pending bool, opts ...ModeOption) error
- func (r *Runtime) DefineOwn(name string) *NounBuilder
- func (r *Runtime) DefinePassthrough(name string) error
- func (r *Runtime) DefineSelection(name, shape string) error
- func (r *Runtime) Deliver(msg tea.Msg) (bool, error)
- func (r *Runtime) DeprecatedNounAlias(name string) (NounAlias, bool)
- func (r *Runtime) Detail(id string) *Detail
- func (r *Runtime) Dispatch(key MacroKey) (bool, error)
- func (r *Runtime) DispatchOutcome(key MacroKey) (KeyOutcome, error)
- func (r *Runtime) DisplayKey(key string) string
- func (r *Runtime) DisplayNoun(noun string) string
- func (r *Runtime) DocsPage(topic string) (header, text string, err error)
- func (r *Runtime) DocsTool() string
- func (r *Runtime) EnsureConfigSettings()
- func (r *Runtime) EnsureHistory()
- func (r *Runtime) EnsureNounPlaces()
- func (r *Runtime) EnsureSegments() []string
- func (r *Runtime) EnsureTerminalLeader()
- func (r *Runtime) EnsureUserActions() []string
- func (r *Runtime) EnsureUserBindings() []string
- func (r *Runtime) Execute(q Request) (any, error)
- func (r *Runtime) ExecuteAt(c Context, q Request) (any, error)
- func (r *Runtime) ExportConfig(dir string, force bool) (ConfigExport, error)
- func (r *Runtime) FocusDisplay() string
- func (r *Runtime) FocusInTopLevel() bool
- func (r *Runtime) FocusNoun() string
- func (r *Runtime) FocusPath() []string
- func (r *Runtime) GuardHolds(name, focus string) (holds, known bool)
- func (r *Runtime) GuardNames() []string
- func (r *Runtime) HandleBinding(key string) (bool, error)
- func (r *Runtime) HandleBindingTimeout(msg BindingTimeoutMsg) (bool, error)
- func (r *Runtime) HandleCall(msg CallMsg)
- func (r *Runtime) HelpModes(place NounPlace, pending bool) []ModeState
- func (r *Runtime) HelpTable(place NounPlace, pending bool) ([]string, []HelpKey)
- func (r *Runtime) HiddenPages() []string
- func (r *Runtime) HidePage(id string) error
- func (r *Runtime) History(n int) []HistoryEntry
- func (r *Runtime) HistoryOf(n int, kinds ...string) []HistoryEntry
- func (r *Runtime) Input(id string) *Input
- func (r *Runtime) Inputs() []*Input
- func (r *Runtime) Instance(id string, opts ...InstanceOption) *Instance
- func (r *Runtime) InstancePath(id string) []string
- func (r *Runtime) Invoked() Invocation
- func (r *Runtime) IsPassthrough(name string) bool
- func (r *Runtime) IsPendingMode(name string) bool
- func (r *Runtime) Issue(owner, verb, slot string, c Ctx) (Ticket, context.Context, error)
- func (r *Runtime) IssueAt(owner, scope, verb, slot string, c Ctx) (Ticket, context.Context, error)
- func (r *Runtime) Jobs() []JobInfo
- func (r *Runtime) JumpFocus(steps int, scope string) error
- func (r *Runtime) KeyEcho() string
- func (r *Runtime) Launch(owner, verb string, res Result, c Ctx) (Ticket, error)
- func (r *Runtime) List(id string) *List
- func (r *Runtime) ListBindings(focus string) []Binding
- func (r *Runtime) Lists() []*List
- func (r *Runtime) LoadBindings(data []byte) ([]Binding, error)
- func (r *Runtime) LoadDefaultBindings(source string, data []byte) error
- func (r *Runtime) LoadDefaultBindingsFS(fsys fs.FS, patterns ...string) error
- func (r *Runtime) Matcher(mode, query string) Matcher
- func (r *Runtime) ModalFocus(id string) string
- func (r *Runtime) ModalReturn(id string) (focus string, mode ModeState)
- func (r *Runtime) Modals() []*Instance
- func (r *Runtime) ModeBadgeKeyCase() string
- func (r *Runtime) ModeBadgeWidth() int
- func (r *Runtime) ModeKnown() bool
- func (r *Runtime) ModeParent(name string) string
- func (r *Runtime) MustLoadDefaultBindings(source string, data []byte)
- func (r *Runtime) NoteNounAlias(name string)
- func (r *Runtime) Noun(name string) *Noun
- func (r *Runtime) NounAliasNotice(name string) (text string, ok bool)
- func (r *Runtime) NounAliasesOf(noun string) []NounAlias
- func (r *Runtime) NounPlaces(noun string) []NounPlace
- func (r *Runtime) NounWords(words []string) (noun string, rest []string, ok bool)
- func (r *Runtime) OnConfigReload(name string, fn func() []string)
- func (r *Runtime) OpenArgsForm(q Request, run func(Request) error) (*RecordEditor, error)
- func (r *Runtime) OpenChooser(spec ChooserSpec) (*Chooser, error)
- func (r *Runtime) OpenModal(kind string, payload Payload, opts ...ModalOption) (*Instance, error)
- func (r *Runtime) OpenPage(id string) error
- func (r *Runtime) OpenPagePicker() (*Chooser, error)
- func (r *Runtime) OpenPathChooser(spec PathChooserSpec) (*Chooser, error)
- func (r *Runtime) OpenRecordEditor(id string, spec RecordSpec) (*RecordEditor, error)
- func (r *Runtime) OpenTextView(title, text string) (*Input, error)
- func (r *Runtime) OpenVisibleStart() error
- func (r *Runtime) Operation(key string) (Operation, bool)
- func (r *Runtime) PageFocus(id string) string
- func (r *Runtime) PageHidden(id string) bool
- func (r *Runtime) PageList() []*Page
- func (r *Runtime) PageOf(id string) *Page
- func (r *Runtime) PaneLayout(id string, l Layout) Layout
- func (r *Runtime) PaneShift(page string) int
- func (r *Runtime) PathStart(pick PathPick) string
- func (r *Runtime) PendingCommands() tea.Cmd
- func (r *Runtime) PendingModes() []string
- func (r *Runtime) Placed(id string)
- func (r *Runtime) PlacedAt(id, text string, focus, height int) string
- func (r *Runtime) Pop() error
- func (r *Runtime) PropGuard(noun, prop string) string
- func (r *Runtime) PropOf(noun, name string) (PropSpec, bool)
- func (r *Runtime) Props(noun string) []PropSpec
- func (r *Runtime) Push(id, focus string) error
- func (r *Runtime) Query(preds ...Predicate) []*Instance
- func (r *Runtime) ReadBareAlias(c Context, words []string, nouns []string) (BareReading, bool, error)
- func (r *Runtime) ReadNounWord(noun, word string, verbs []string) NounWord
- func (r *Runtime) ReadYank(register string) (Yank, error)
- func (r *Runtime) RecentPaths() []string
- func (r *Runtime) RecordEditor(id string) *RecordEditor
- func (r *Runtime) ReferenceModel() refdoc.Model
- func (r *Runtime) Register(o Operation)
- func (r *Runtime) RegisterPage(page *Page, opts ...InstanceOption) error
- func (r *Runtime) RegisterPredicate(name string, fn PredicateFunc)
- func (r *Runtime) Registers() *Registers
- func (r *Runtime) ReloadConfig() ([]string, error)
- func (r *Runtime) ReloadThemes() []string
- func (r *Runtime) ReloadUserActions() []string
- func (r *Runtime) ReloadUserBindings() []string
- func (r *Runtime) ReloadUserSegments() []string
- func (r *Runtime) RemoveInstance(id string) error
- func (r *Runtime) RemoveVerbAvailability(key, guard string) bool
- func (r *Runtime) RemoveVerbCheck(key, name string) bool
- func (r *Runtime) RenameSelect() bool
- func (r *Runtime) ResolveAction(name string) (Operation, Invocation, bool)
- func (r *Runtime) RetargetFocus(match func(id string) bool, to string)
- func (r *Runtime) SearchCase() string
- func (r *Runtime) SearchMatch() string
- func (r *Runtime) SegmentCells() []SegmentCell
- func (r *Runtime) SegmentProvider(name string, fn SegmentProvider)
- func (r *Runtime) Segments() []SegmentState
- func (r *Runtime) SegmentsShown() bool
- func (r *Runtime) SelectedBackground() string
- func (r *Runtime) SelectionMode(shape string) string
- func (r *Runtime) SelectionShape(mode string) string
- func (r *Runtime) SetAvailability(key, guard string)
- func (r *Runtime) SetConfirm(key, prompt string) error
- func (r *Runtime) SetFocus(id string) error
- func (r *Runtime) SetMode(mode string) error
- func (r *Runtime) SetPaneShift(page string, shift int) (int, error)
- func (r *Runtime) SetPathBase(fn func(PathPick) string)
- func (r *Runtime) SetRecentPaths(fn func(PathPick) []string)
- func (r *Runtime) SetTableState(id string, s TableState)
- func (r *Runtime) SetTerminalLeader(key string) error
- func (r *Runtime) SetWatchVersions(v WatchVersions) WatchVersions
- func (r *Runtime) Settings() *Settings
- func (r *Runtime) Settle(t Ticket, err error) bool
- func (r *Runtime) ShowMatch() bool
- func (r *Runtime) ShowPage(id string) error
- func (r *Runtime) Snapshot() map[string]any
- func (r *Runtime) Sourced(source string) (restore func())
- func (r *Runtime) StandardShadows() []string
- func (r *Runtime) StandardVerbsView() StandardVerbsView
- func (r *Runtime) Start(owner string, work func(context.Context) (any, error), ...) (Ticket, error)
- func (r *Runtime) StopBindings() []StopBindings
- func (r *Runtime) StoreYank(y Yank, register string, deletion bool) error
- func (r *Runtime) TabPages() []*Page
- func (r *Runtime) TableState(id string) TableState
- func (r *Runtime) TargetInstance(target string) (string, error)
- func (r *Runtime) Terminal(id string) *Terminal
- func (r *Runtime) TerminalLeader() string
- func (r *Runtime) Timeline(id string) *Timeline
- func (r *Runtime) TopModal() string
- func (r *Runtime) Tree(id string) *Tree
- func (r *Runtime) TreeBreadcrumb() string
- func (r *Runtime) TreeBreadcrumbAncestors() int
- func (r *Runtime) TreeZoomMode() string
- func (r *Runtime) TreeZoomRoot() string
- func (r *Runtime) UI() *UI
- func (r *Runtime) Unalias(alias string) error
- func (r *Runtime) UnreachableBindings() []string
- func (r *Runtime) UseParamAliases(q Request) (Request, []string)
- func (r *Runtime) UserActions() []Action
- func (r *Runtime) UserAliases() []ActionAlias
- func (r *Runtime) ValidateBindings() ([]string, error)
- func (r *Runtime) VerbAvailability(key string) []string
- func (r *Runtime) VerbChecks(key string) []string
- func (r *Runtime) VerbGuard(key string) string
- func (r *Runtime) VerbShown(key, focus string, mode ModeState) bool
- func (r *Runtime) Watch(noun string, args Arguments, fn func(WatchEvent)) (*Watch, error)
- type Scheme
- type SchemeColor
- type SchemeSet
- type Segment
- type SegmentCell
- type SegmentMsg
- type SegmentProvider
- type SegmentState
- type SegmentTickMsg
- type SegmentValue
- type Server
- type Setting
- type SettingDiff
- type SettingOwner
- type SettingOwnerInfo
- type SettingSection
- type SettingSectionInfo
- type SettingShown
- type SettingValue
- type SettingWritten
- type Settings
- func (s *Settings) Autosave() bool
- func (s *Settings) Bool(name string) bool
- func (s *Settings) Declared() []Setting
- func (s *Settings) Diff() []SettingDiff
- func (s *Settings) Duration(name string) time.Duration
- func (s *Settings) Float(name string) float64
- func (s *Settings) FrameworkSetting(name string) bool
- func (s *Settings) Get(name string) (SettingValue, error)
- func (s *Settings) HasSession() bool
- func (s *Settings) Int(name string) int
- func (s *Settings) List() []SettingValue
- func (s *Settings) Observe(name string, fn func(name string, value any))
- func (s *Settings) Origin(name string) (Origin, error)
- func (s *Settings) OwnerOf(name string) string
- func (s *Settings) Owners() []SettingOwnerInfo
- func (s *Settings) Problems() []string
- func (s *Settings) Reload() []string
- func (s *Settings) ReloadIfChanged() bool
- func (s *Settings) Reset(name string) error
- func (s *Settings) ResetAll() (string, []string, error)
- func (s *Settings) ResetSession(name string) (string, error)
- func (s *Settings) Revert(name string) error
- func (s *Settings) RevertAll() []string
- func (s *Settings) Sections(owner string) ([]SettingSectionInfo, error)
- func (s *Settings) Session(name string) (any, bool)
- func (s *Settings) Set(name string, value any) error
- func (s *Settings) SetSession(name string, value any) (string, error)
- func (s *Settings) StartSession()
- func (s *Settings) String(name string) string
- func (s *Settings) Strings(name string) []string
- func (s *Settings) Value(name string) (any, bool)
- func (s *Settings) Write(name string) (bool, error)
- func (s *Settings) WriteAll() ([]string, error)
- type SettingsApplied
- type SettingsPollMsg
- type SplitSide
- type StandardVerbsView
- type StopBindings
- type Store
- type Styles
- func (s Styles) CardBorders() (focused, selected, other lipgloss.Style)
- func (s Styles) Chrome(role string, fallback lipgloss.Style) lipgloss.Style
- func (s Styles) ChromeLevel() string
- func (s Styles) Fade(percent int) lipgloss.Style
- func (s Styles) HasChrome(roles ...string) bool
- func (s Styles) Tone(name string) lipgloss.Style
- func (s Styles) WithBackdropHighlights(keep bool) Styles
- func (s Styles) WithChrome(level string, modeRoles []string) Styles
- func (s Styles) WithDims(modal, unfocused int) Styles
- type Suggestion
- type TableState
- type Terminal
- func (t *Terminal) Close()
- func (t *Terminal) Err() string
- func (t *Terminal) Focused() bool
- func (t *Terminal) Frame() TerminalFrame
- func (t *Terminal) HandleMessage(msg tea.Msg) bool
- func (t *Terminal) ID() string
- func (t *Terminal) Overlay() *TerminalOverlay
- func (t *Terminal) PendingCommand() tea.Cmd
- func (t *Terminal) SetOverlay(o *TerminalOverlay)
- func (t *Terminal) Size() (cols, rows int)
- func (t *Terminal) View(width, height int) string
- func (t *Terminal) ViewBlock(width, height int) Block
- type TerminalFrame
- type TerminalOverlay
- type TerminalReleaser
- type TerminalStream
- type Thing
- type ThingChange
- type Ticket
- type Timeline
- func (t *Timeline) BodyID() string
- func (t *Timeline) CanScrollLines() bool
- func (t *Timeline) Cards() []Card
- func (t *Timeline) Focus() error
- func (t *Timeline) FocusTarget() string
- func (t *Timeline) Folded(id, section string) bool
- func (t *Timeline) Following() bool
- func (t *Timeline) ID() string
- func (t *Timeline) InBody() bool
- func (t *Timeline) IsOpen(id string) bool
- func (t *Timeline) List() *List
- func (t *Timeline) Patch(cards ...Card) error
- func (t *Timeline) ScrollLines(lines int)
- func (t *Timeline) Select(id string) error
- func (t *Timeline) Selected() (Card, bool)
- func (t *Timeline) SelectedID() string
- func (t *Timeline) SetAllOpen(open bool)
- func (t *Timeline) SetCards(cards []Card) error
- func (t *Timeline) SetFolded(id, section string, folded bool) error
- func (t *Timeline) SetOpen(id string, open bool) error
- func (t *Timeline) SetParentStop(id string)
- func (t *Timeline) Step() (card string, step int, ok bool)
- func (t *Timeline) StepText() (string, bool)
- func (t *Timeline) View(width, height int) string
- type ToneSpan
- type ToneStyle
- type Tree
- func (t *Tree) Block(width, height int) Block
- func (t *Tree) Breadcrumb() []string
- func (t *Tree) Close()
- func (t *Tree) CollapseAll() error
- func (t *Tree) Collapsed(id string) bool
- func (t *Tree) DebounceCurrent(tick TreeDebounceMsg) bool
- func (t *Tree) DebounceTick() (TreeDebounceMsg, bool)
- func (t *Tree) Edit(id string, selected bool) error
- func (t *Tree) Editable() bool
- func (t *Tree) Editing() string
- func (t *Tree) Failure() error
- func (t *Tree) Flush() error
- func (t *Tree) Focus() error
- func (t *Tree) FocusTarget() string
- func (t *Tree) HandleMessage(msg tea.Msg) bool
- func (t *Tree) Height() int
- func (t *Tree) ID() string
- func (t *Tree) List() *List
- func (t *Tree) Nodes() []TreeNode
- func (t *Tree) PendingCommand() tea.Cmd
- func (t *Tree) Record(a TreeAction) error
- func (t *Tree) Select(id string) error
- func (t *Tree) Selected() (TreeNode, bool)
- func (t *Tree) SetCollapsed(id string, collapsed bool) error
- func (t *Tree) SetNodes(nodes []TreeNode) error
- func (t *Tree) View(width, height int) string
- func (t *Tree) Zoom(id string) error
- func (t *Tree) ZoomOut() error
- func (t *Tree) Zoomed() string
- type TreeAction
- type TreeChange
- type TreeDebounceMsg
- type TreeNode
- type UI
- func (u *UI) Attach(s UISink) UISink
- func (u *UI) ClearNotice(id NoticeID)
- func (u *UI) Close()
- func (u *UI) Error(text string)
- func (u *UI) HandleMessage(tea.Msg) bool
- func (u *UI) Info(text string)
- func (u *UI) Notify(text string) NoticeID
- func (u *UI) PendingCommand() tea.Cmd
- func (u *UI) Sink() UISink
- func (u *UI) Status(text string)deprecated
- type UIMessage
- type UISink
- type VerbCheck
- type Verbatim
- type Verdict
- type Watch
- type WatchEvent
- type WatchQuery
- type WatchVersions
- type Yank
Examples ¶
Constants ¶
const ( AliasFramework = "framework" // the framework's own old names (registered inside Builtin) AliasApp = "app" // an application's NounBuilder.Alias, Renamed or Runtime.AliasAction AliasConfig = "config" // a row of the user's actions.json AliasStandard = "standard" // generated with a standard verb (NOUN.patch for NOUN.set); gives way, unrecorded, to an application verb of its name )
Alias sources: who declared an alias.
const ( AliasShadowRefuse = "refuse" AliasShadowAllow = "allow" )
The values of AliasShadowSetting.
const ( SinglePathChooser = "chooser" SinglePathAlone = "alone" SinglePathForm = "form" )
The values of SinglePathSetting.
const ( BindingsGrouped = "grouped" BindingsRows = "rows" )
Bindings file formats, as ParseBindings and bindings check report them.
const ( // ChooserRememberSourceSetting reopens a chooser with sources on the // source last used for its kind (on), or on its first source (off). ChooserRememberSourceSetting = "chooser.remember-source" // ChooserEnterSetting is what enter does on a row that can be both // opened and picked (a folder in a folder chooser): "open" (the // default; alt+enter picks) or "pick" (ctrl+l opens). ChooserEnterSetting = "chooser.enter" )
Chooser settings: rows of settings/ochazuke.json.
const ( ChooserSourcesGuard = "chooser-sources" // more than one source ChooserOpensGuard = "chooser-opens" // the highlighted row opens ChooserEnterOpensGuard = "chooser-enter-opens" // enter opens it (ChooserEnterSetting, or a row that only opens) ChooserUpGuard = "chooser-up" // the source can step up ChooserUpEmptyGuard = "chooser-up-empty" // it can, and the query is empty (backspace) )
Chooser guards: the rows of chooser.json name them.
const ( // ChromeColorSetting is the chrome colour level, a row of // settings/ochazuke.json (appearance). ChromeColorSetting = "chrome.color" ChromeOff = "off" ChromeSubtle = "subtle" ChromeRich = "rich" )
Chrome colour: how much colour the chrome (borders, the mode badge, the hint lines) draws is the setting chrome.color, a level: off, subtle or rich. A level is a family of tone rows, chrome.<level>.<role> (the role border.focused at rich is the tone chrome.rich.border.focused), so every colour is data: the built-in rows are in chromeTones, and a themes.json entry overrides any of them as it does any tone. A role with no row at the level draws as it did before the levels existed, so off, which has no rows, is that look exactly.
A chrome row's colours may name the palette roles a tone names, plus mode: the colour of the current mode's badge (its row's background, else its foreground). An application's accent (Appearance.Accent) replaces the accent, border and mode roles in chrome rows, as it replaces the accent everywhere else.
Roles (the fallback is the look before the levels):
border an unfocused panel's border
border.focused a focused panel's border (heavy lines stay)
border.<tone> a panel given a tone (Layout.WithPanelTone), a card's (Card.Tone)
border.modal a modal's border
border.completion the completion popup's border
border.split the path picker's split rule
panel.title an unfocused panel's title
panel.title.focused a focused panel's title
title.mark, title the title row's ◆ and the title
mode.<name>, mode.pending, the mode badge: the first row that exists of
mode.<extends>, mode the mode's own, pending (a pending mode),
the mode it extends, then mode
hint.key, hint.text, the footer's and every modal's hint line:
hint.sep a row's key, its action, the " · " between
const ( SettingsReferenceFile = "settings.reference.json" BindingsReferenceFile = "bindings.reference.json" PropsReferenceFile = "props.reference.json" ActionsExampleFile = "actions.example.json" ThemesExampleFile = "themes.example.json" ReferenceReadme = "README.md" )
The files config.export writes.
const ( BindingsFile = "bindings.json" SettingsFile = "settings.json" )
BindingsFile and SettingsFile are the file names in the config directory.
const ( // SourceGo is a default row bound in Go (Bind, ModeBuilder.Bind): an // application's own, or one computed at runtime (an instance's rows). SourceGo = "go" // SourceGenerated is a key sequence's prefix cancel ("g esc"), which // the framework adds to every table with a sequence. SourceGenerated = "generated" )
Source labels of bindings defaults for rows no file declared.
const ( JobRunning = "running" JobDone = "done" JobFailed = "failed" JobCancelled = "cancelled" )
Job states as jobs.list and the snapshot report them.
const ( KindInteraction = "interaction" // runs synchronously on the loop (default) KindApplication = "application" // an AppHandler; pending work runs off the loop )
Operation kinds.
const ( FocusDisplayOff = "off" FocusDisplayNoun = "noun" FocusDisplayStack = "stack" )
The focus-display values, in the order focus.display cycles them.
const ( HelpHere = "here" HelpPick = "pick" HelpTable = "table" )
The ? help's views. Here is what the focus answers to now (BindingHelp, the default). Pick is the same table for a chosen noun and mode, as if the focus were on that noun in that mode (NounHelp). Table is a chosen noun's keys by mode: a row per key or key class, a column per mode with rows for the noun or app, each cell the operation that answers there. S and tab (bindings-help.view {step}; shift+tab backwards) cycle the views the settings leave on; n (bindings-help.noun) chooses the noun of pick and table, m (bindings-help.mode) the mode of pick, p (bindings-help.place) the place of pick and table: one of the noun's recorded places (NounPlaces), whose chain gives the walk the levels between the noun and app, or no place. All four are rows on the help modal's noun, guarded so they answer, and are hinted, only where they do something.
const ( HelpPickSetting = "help.pick-view" HelpTableSetting = "help.table-view" HelpPendingSetting = "help.pending-modes" )
The help's settings, rows of settings/ochazuke.json (section help): whether pick and table are in S's cycle (both default on; with both off S does nothing and is not offered) and whether the pending modes (counts, operators, registers, the terminal leader, key-sequence prefixes) are pick's mode choices and table's columns (default off).
const ( HistoryAction = "action" HistoryChange = "change" HistoryFetch = "fetch" HistorySystem = "system" )
The kinds of history entry (HistoryEntry.Kind, Operation.HistoryKind). An action is the user's interaction (a motion, a focus, page or modal move, a mode, the palette's line), a change is an edit or a mutating verb (what dot-repeat reads), a fetch asks for data (a state, list or show verb, a reload, a host calling an extension). HistorySystem is reserved for what the runtime does on its own (a resize, a job that finished); no entry has it yet.
const ( KeyEchoSetting = "keys.echo" KeyEchoWidthSetting = "keys.echo-width" KeyEchoCountSetting = "keys.echo-count" KeyEchoLingerSetting = "keys.echo-linger" KeyEchoTypingSetting = "keys.echo-typing" KeyEchoCommandsSetting = "keys.echo-commands" KeyEchoTerminalSetting = "keys.echo-terminal" )
The key echo settings.
const ( KeyEchoOff = "off" KeyEchoBadge = "badge" )
The keys.echo placements, in the order key.echo cycles them.
const ( KeyEchoTypingText = "text" KeyEchoTypingCount = "count" )
The keys.echo-typing values.
const ( PaneStep = 5 PaneShiftLimit = 30 PaneMinWidth = 16 PaneMinHeight = 3 )
The pane limits: PaneStep is the percent points one pane.grow or pane.shrink moves a divider; PaneShiftLimit bounds Layout.Shift either way; Divide keeps PaneMinWidth cells on each side of a side-by-side split and PaneMinHeight rows on each side of a stacked one, so neither panel collapses.
const ( ModeBadgeKeysUpper = "upper" ModeBadgeKeysAsTyped = "as-typed" )
The mode-badge.key-case values.
const ( ModeBadgeWidthWidest = "widest" ModeBadgeWidthFit = "fit" )
The mode-badge.width values.
const ( NounsDisplayShortest = "shortest" NounsDisplayFramework = "framework" NounsDisplayCanonical = "canonical" )
The nouns.display values: shortest (the shortest live alias, any noun), framework (only the framework nouns' short names, before v0.57) and canonical (every noun by its registered name).
const ( SourceKey = "key" SourceDigit = "digit" SourceText = "text" SourceCount = "count" SourceLine = "line" SourceSteps = "steps" SourceOp = "op" SourceOpCount = "opcount" SourcePrefix = "prefix" SourceLetter = "letter" SourceRow = "row" )
Sources a From entry may name: "key" (the key name), "digit" (the key as an integer), "text" (pasted or typed text), "count" (payload count, at least 1), "line" (payload count, 0 when absent, else the operator count), "steps" (count times operator count), "op" (payload operator), "opcount", "prefix" (the key sequence the pending mode holds), "letter" (the key's letter, lowercased, without ctrl+ or shift+: f, F, shift+f and ctrl+f all read f; "" for a key that is not one letter), "row" (the row's Data, see FromRow) and "row:<field>" (one field of it). A From value may name several sources separated by spaces ("prefix key"): their texts are joined with a space, the way terminal.send reads a key list.
const ( Digit = "digit" Alpha = "alpha" Printable = "printable" // Upper is one uppercase letter (A to Z, any script's capital): it // answers before Alpha, which an uppercase letter also belongs to. Upper = "upper" // CtrlAlpha is one ctrl+letter, ctrl+a to ctrl+z: one row for every // control letter, the letter read with the letter source. A legacy // terminal sends ctrl+h, ctrl+i, ctrl+j and ctrl+m as backspace, tab // and enter, and ctrl+[ as esc, so those never reach the row there; // labels a row reads this way should avoid h, i, j and m. CtrlAlpha = "ctrl+alpha" Paste = "paste" Any = "any" )
Pattern names.
const ( SelectionChar = "char" // characters from the anchor to the cursor (visual) SelectionLine = "line" // whole lines or list rows (visual-line, V) SelectionBlock = "block" // a rectangle (visual-block) )
Selection shapes: a mode that holds a selection says which shape it selects (DefineSelection, a bindings file's "modes" entry {"selection": "line"}). Code asks the shape, never a mode's name: the editor draws and edits by it, a list starts its row selection when a line-shaped mode is entered on it (list_visual.go).
const ( PathFile = "file" // the default PathDir = "dir" )
Path variants (Parameter.Path).
const ( PathStartSetting = "path.start" PathFieldSetting = "path.field" PathHiddenSetting = "path.hidden" PathNoAutoListSetting = "path.no-auto-list" )
Path settings: rows of settings/ochazuke.json.
const ( PathSourceBrowse = "browse" PathSourceRecent = "recent" PathSourceTyped = "typed" )
The path chooser's own sources, in order.
const ( // Collection is many things with keys, held by the application // (note, task, project). Collection = "collection" // Singleton is one thing per runtime (app, appearance): get takes no // subject. Singleton = "singleton" // Instances is things that are live runtime instances (pages, panes): // the things are the noun's instances, in registration order, and the // subject is an instance id (instancesStore). The store's Get, when // set, adds the props an instance does not hold; List is the // instances unless the store gives its own. Instances = "instances" )
The kinds of store (Store.Kind): what the subject is and which standard verbs make sense.
const ( // RoleLabel is the prop a thing is shown by: list rows' label, // {{label}} in a confirm or an action template, and choosers. RoleLabel = "label" // RoleOwner is the reference prop naming the thing that holds this one // (move writes it). RoleOwner = "owner" // RoleArchive is the boolean prop that says a thing is archived // (archive and restore write it; delete reads it under the // delete.archive setting). RoleArchive = "archive" )
The prop roles (PropSpec.Role): one prop per role.
const ( FormNoun = "ochazuke.form" FormFieldNoun = "ochazuke.form-field" FormTextNoun = "ochazuke.form-text" FormChoiceNoun = "ochazuke.form-choice" FormOptionNoun = "ochazuke.form-option" // FormSuggestNoun is a free text field with suggestions: an input // whose enter (normal) and ctrl+space open the suggestions chooser. FormSuggestNoun = "ochazuke.form-suggest" // FormSuggestionsKind is the suggestions chooser's modal kind // (Runtime.Chooser(FormSuggestionsKind) while it is open). FormSuggestionsKind = "form-suggestions" )
Form nouns: the editor, its text fields (single- and multi-line), its choice fields, and the chooser's rows. ("form", not "record", so the palette's words do not collide with the macro verb record.)
const ( FormRunnableGuard = "form-runnable" FormMissingGuard = "form-missing" )
Form availability: form.run is available on a form that runs once (Submit) whose every field is valid (form-runnable), form.next-missing on one with a field still not valid (form-missing). On such a form one of the two always is, so enter's rows (run, next-missing, the field's own action) never fall through to the field's own; on an editor that writes each change neither is, and enter keeps its old action.
const ( // SearchCaseSmart ignores case unless the query holds an upper-case // letter, then matches case exactly (Vim's ignorecase with smartcase). SearchCaseSmart = "smart" // SearchCaseIgnore always ignores case (Vim's ignorecase). SearchCaseIgnore = "ignore" // SearchCaseSensitive always matches case (Vim's noignorecase). SearchCaseSensitive = "sensitive" )
The values of search.case.
const ( // SearchMatchSetting is the "/" list filter's starting mode. SearchMatchSetting = "search.match" // ChooserMatchSetting is the starting mode of choosers and the path // picker. ChooserMatchSetting = "chooser.match" // SearchShowMatchSetting draws the mode's tag on the search line. SearchShowMatchSetting = "search.show-match" )
The match settings: rows of settings/ochazuke.json.
const ( MatchSubstring = "substring" MatchFuzzy = "fuzzy" MatchRegex = "regex" )
The match modes.
const ( // SegmentsSetting shows (true, the default) or hides the whole // segments area. SegmentsSetting = "status.segments" // SegmentOrderSetting is the order the user gave the segments // (segment.move): ids first to last; segments it leaves out follow in // their rows' order. SegmentOrderSetting = "status.segment-order" // SegmentsFile is the user's segments file in the config directory: // a JSON array of Segment rows. A row naming an existing id changes // that segment's fields; a new id adds a segment. SegmentsFile = "segments.json" )
The segment settings.
const ( DefaultSegmentEvery = 5 * time.Second MinSegmentEvery = 250 * time.Millisecond DefaultSegmentTimeout = 2 * time.Second // SegmentMaxWidth is the most cells one segment's text takes. SegmentMaxWidth = 32 )
Segment defaults and bounds.
const ( ScopeSession = "session" ScopeFile = "file" )
The scopes a setting verb writes (the scope argument).
const ( SettingString = "string" // string; Enum limits it SettingInteger = "integer" // int SettingNumber = "number" // float64 SettingBoolean = "boolean" // bool SettingDuration = "duration" // time.Duration, written as "400ms" SettingList = "list" // []string, written as a JSON array )
Setting types: the value a setting holds, as its getter returns it.
const ( // SequenceTimeoutSetting is how long every pending key sequence (a // multi-key row's prefix such as g of g g, and a row entering a // pending mode with a prefix, such as the terminal leader) waits for // its next key before the shorter binding runs: a duration, 0 (the // default) waits until a key comes. SequenceTimeoutSetting = "sequence-timeout" // SequenceUnknownSetting says what a key no row continues a pending // sequence with does: SequencePass (the default) or SequenceSwallow. SequenceUnknownSetting = "sequence-unknown" // SequencePass ends the sequence, runs its shorter binding (the // leader alone: send it to the pane) and handles the key as if it // were typed alone. SequencePass = "pass" // SequenceSwallow drops the sequence and the key, with a notice // naming the keys. SequenceSwallow = "swallow" // SequenceInheritedSetting says whether a sequence a mode inherits // from the mode it extends (a row noun's normal d d, read in // visual-line) waits over a row the mode binds on its own for the // keys typed (the list's visual-line d): SequenceDrop (the default) // lets the mode's own row answer at once, SequenceKeep lets the // inherited sequence wait, as before. SequenceInheritedSetting = "sequence-inherit" // SequenceDrop: an inherited sequence never shadows the mode's own // shorter row. SequenceDrop = "drop" // SequenceKeep: an inherited sequence waits as any other does. SequenceKeep = "keep" // RenameSelectSetting opens a rename (outline.edit without select, a // RecordSpec with Rename) with the whole text selected (Input.SelectAll): // typing replaces it, a motion keeps it. Default on; off opens it with // the cursor at the end. RenameSelectSetting = "rename.select" // CreateFromFocusSetting lets the standard create fill a reference // prop declared FromFocus from the focused thing of its noun when the // request omits it, the fill shown in the palette slot, the args form // and create's notice. Default on; off fills nothing and the reference // stays empty (never a refusal). CreateFromFocusSetting = "create.from-focus" // DeleteArchiveSetting makes the standard delete archive a live thing // of a noun with a RoleArchive prop (it sets the prop) and delete an // archived one for real; nouns without the role are unchanged. Default // off: delete is the store's delete. DeleteArchiveSetting = "delete.archive" // DeleteArchiveConfirmSetting is whether a delete that will only // archive (DeleteArchiveSetting) asks first, with DefaultArchiveConfirm. // Default on; off archives without asking (archive is undone by // restore). The real delete of an archived thing always asks. DeleteArchiveConfirmSetting = "delete.archive-confirm" // CLIStandardVerbsSetting is how the CLI's help shows a noun's // standard verbs (cli.Mount): CLIStandardVerbsLine (the default, // owner decision 24) names them on one line of the noun's help and // after "· std" in its summary, its named verbs keeping their // entries; CLIStandardVerbsList lists each as its own entry, as // before standard verbs. Every verb runs either way. CLIStandardVerbsSetting = "cli.standard-verbs" CLIStandardVerbsLine = "line" CLIStandardVerbsList = "list" // VisualAfterActionSetting is what a key acting on a visual selection // of list rows leaves: VisualAfterEnd (the default, as in Vim) or // VisualAfterKeep. VisualAfterActionSetting = "visual.after-action" // VisualAfterEnd ends the selection and leaves visual-line. VisualAfterEnd = "end" // VisualAfterKeep keeps the selection over the rows still shown. VisualAfterKeep = "keep" // VisualListSetting is what V does on a list: VisualListMode (the // default) enters visual-line; VisualListMarks selects in normal // mode, the older selection. VisualListSetting = "visual.list" // VisualListMode enters visual-line. VisualListMode = "mode" // VisualListMarks selects in normal mode. VisualListMarks = "marks" // RepeatEmptySetting is what dot-repeat with nothing to repeat at the // focus does: RepeatEmptyInfo (the default) or RepeatEmptySilent. RepeatEmptySetting = "repeat.empty" // RepeatEmptyInfo says "nothing to repeat" on the status line, plain. RepeatEmptyInfo = "info" // RepeatEmptySilent shows nothing. RepeatEmptySilent = "silent" )
The framework settings the key resolver reads.
const ( // OwnerFramework owns the framework's settings: the embedded rows and // what a framework feature declares (inside Runtime.Builtin). OwnerFramework = FrameworkNamespace // OwnerApp owns a setting that names no owner: the declaring // application's. Its title, unless declared, is Config.App. OwnerApp = AliasApp // SettingsGeneralSection is the section of a setting whose name has // no dot and that names no section. SettingsGeneralSection = "general" )
Owners and sections: where the Settings page files each setting. A setting's owner (Setting.Owner, resolved by Settings.OwnerOf) is a tab of the page; its section (Setting.SectionName) is a row of the tab's section list; its group (Setting.Group) a heading inside the section. Which owner, section and group a setting has comes only from these fields: no code looks at a setting's name beyond the first-dot rule of SectionName.
SettingOwner and SettingSection declarations give an owner or a section its title, a one-line description and its place in the order; without one the title is the ID and the order is the order the owner's or the section's first setting was declared. The framework's own declarations are the embedded settings/sections.json; an application adds its own with Runtime.DeclareSettingOwner and Runtime.DeclareSettingSection.
const ( // SettingsLayoutSetting is the Settings page's layout: // SettingsLayoutTabsSections (the default), SettingsLayoutTabs or // SettingsLayoutSections. SettingsLayoutSetting = "settings.layout" SettingsLayoutTabsSections = "tabs+sections" SettingsLayoutTabs = "tabs" SettingsLayoutSections = "sections" // SettingsNarrowWidthSetting is the page width below which the section // list folds into a selector line; 0 never folds. SettingsNarrowWidthSetting = "settings.narrow-width" )
The Settings page's layout (settings.layout): which owners and sections (settings_owners.go) are tabs across the top and which are rows of the section list on the left.
- tabs+sections (the default): a tab per owner (drawn with more than one), the shown tab's sections in the section list, the shown section's settings over the detail on the right. Below settings.narrow-width columns the section list folds into a selector line at the top of the settings panel.
- tabs: a tab per section, every owner's, and no section list (the page before owners).
- sections: no tabs; the section list holds every owner's sections, each owner's under a heading row (Vim's :options contents).
The section list (settingsSectionsID) is an ordinary List whose rows are the ochazuke.settings-section noun; it is drawn before the settings list, so j past its last row spills into the settings (R3.4). A section row's verbs (open, reset, write, revert, copy, pick) have twins at owner level on ochazuke.settings-tab, sharing the handlers. ] and [ (settings.tab) step the tabs; tab and shift+tab (settings.section {across}) walk every section in drawing order.
const ( // SettingsAutosaveSetting makes every session write go to // settings.json at once (boolean, default false: session values stay // in memory until settings.write). SettingsAutosaveSetting = "settings.autosave" // SettingsMarkSessionSetting draws a session value bold on the // Settings page with the persisted value beside it (boolean, default // true). SettingsMarkSessionSetting = "settings.mark-session" )
The framework settings of the session layer.
const ( OriginDefault = "default" OriginFile = "file" OriginSession = "session" )
The layers a setting's value comes from (Origin.Layer).
const ( // SettingsPageID is the Settings page's instance id. SettingsPageID = "__settings" // SettingsGeneral titles the section of the settings without one. SettingsGeneral = "General" )
The Settings page: settings.edit opens (or switches to) a framework page of the declared settings, laid out by settings.layout (settings_page_layout.go): by default the owners are tabs across the top (the application, its declared owners, ochazuke; ] and [ step them), the shown tab's sections a list on the left (tab and shift+tab walk every section in drawing order, across the tabs), and the shown section one list of rows on the right, a setting a row: its full name on the left (a • after a name whose value is not the default), its value on the right (‹ value › for one h/l steps); a group's rows sit under its heading. A list setting's row reads its item count, and each item is a row beneath it with the name column blank. Under the list the selected setting's description says what its default is, where its value comes from (the default, settings.json, or the default because settings.json holds an invalid value) and what it takes; J/K scroll it.
Every change is saved as it is made; there is no save key. On a setting row enter edits (a boolean flips, an enum takes its next value, a list takes a new item, any other type opens a one-line prompt prefilled with the value), l/h and space step a boolean, an enum or a number, n adds an item to a list, r (or backspace, delete) resets to the default. On an item row enter or i edits the item, n adds one after it, d d deletes it, r resets the whole list. u (or ctrl+z) takes back the last change made on the page. q or esc (settings.close) goes back to the page the Settings page was opened from, with its remembered focus and mode; the page reopens on the section and row it was left on. A value another process sets (the poll) redraws the open lists.
settings.edit registers the page on first use and settings.close removes it again, so it is a tab only while it is open; an application that wants it as a permanent tab calls AddSettingsPage.
const ( NounWordVerb = "verb" NounWordProp = "prop" )
Word kinds ReadNounWord answers.
const ( StandardVerbsSetting = "palette.standard-verbs" // StandardVerbsLast lists a noun's named verbs before its standard // ones in the palette's verb column (the default). StandardVerbsLast = "last" // StandardVerbsMixed lists them in one alphabetical list. StandardVerbsMixed = "mixed" // StandardVerbsHidden leaves standard verbs out of the verb column; // typing the name, the CLI and bindings still reach them. StandardVerbsHidden = "hidden" // StandardVerbsTag marks a standard verb "std" in the verb column. StandardVerbsTag = "tag" // StandardVerbsRecord shows a standard get's answer (one thing) as // prop and value rows in the palette's results view. StandardVerbsRecord = "record" )
The palette.standard-verbs setting (plan 2.10, owner decision 25): one list setting for every standard-verb change to the palette. Its parts are an ordering (StandardVerbsLast, StandardVerbsMixed or StandardVerbsHidden; none is mixed, today's one alphabetical list) and the flags StandardVerbsTag and StandardVerbsRecord. A part left out returns its piece to today's behaviour, so [] turns them all off.
const ( WatchAdded = "added" WatchModified = "modified" WatchDeleted = "deleted" )
The types of a WatchEvent.
const ( TerminalLeaderSetting = "terminal-leader" DefaultTerminalLeader = "ctrl+a" )
The terminal leader setting: the key that enters leader_pending. Its default is in settings/ochazuke.json; DefaultTerminalLeader is the fallback when the setting holds a key that is not a leader.
const ( DefaultModalDim = 35 // about the scheme's muted colour, as the backdrop always was DefaultDimUnfocused = 20 MaxDim = 90 )
Dim defaults, in percent toward the background (the settings modal-dim and dim-unfocused, Model.Styles).
const ( ModalDimSetting = "modal-dim" DimUnfocusedSetting = "dim-unfocused" // ModalBackdropHighlightsSetting: keep (the page's reverse video and // underline beneath a modal stay, dimmed) or plain (the backdrop is // drawn without them). ModalBackdropHighlightsSetting = "modal-highlights" )
The dim settings: rows of settings/ochazuke.json.
const ( ToneWorking = "state.working" ToneNeedsInput = "state.needs-input" ToneDone = "state.done" ToneErrored = "state.errored" ToneIdle = "state.idle" ToneExited = "state.exited" ToneStar = "marker.star" ToneQueued = "marker.queued" // ToneSession marks a setting's session value on the Settings page // (set this session, not written): bold in every theme, mono too. ToneSession = "marker.session" // ToneError marks a cell that is wrong (a duplicate key, a value that // does not parse): bold on an error background in every built-in // theme, bold alone in mono. ToneError = "error" // ToneChip draws a chip (a query term, a tag) on a dim background; // ToneChipFocused is the chip the focus is on, bright: the scheme's // surface on its accent, bold. mono draws the focused chip bold. ToneChip = "chip" ToneChipFocused = "chip.focused" )
The tones every built-in theme draws (defaultTones); applications and themes.json add their own names.
const ( SelectedBackgroundDrop = "drop" SelectedBackgroundKeep = "keep" )
The values of SelectedBackgroundSetting.
const ( TreeAdd = "add" TreeRename = "rename" TreeMove = "move" TreeDelete = "delete" )
Tree change operations.
const ( // TreeZoomSetting is how a tree zooms: TreeZoomManual (the default) // only through the zoom verbs, TreeZoomAuto also when the selected // row's indent takes more than half the tree's width, TreeZoomOff // never (the verbs are unavailable and a zoom in place is dropped). TreeZoomSetting = "tree.zoom" // TreeZoomRootSetting is where the zoomed-on node goes: // TreeZoomRootCrumb (the default) ends the breadcrumb and its children // are the top rows; TreeZoomRootRow keeps it as the top row. TreeZoomRootSetting = "tree.zoom.root" // TreeBreadcrumbSetting is where a zoomed tree draws its breadcrumb: // TreeBreadcrumbLine (the default) a dimmed line above the rows, // TreeBreadcrumbTitle the header beside the mode (after the focus // display) while the tree holds the focus, TreeBreadcrumbOff nowhere. TreeBreadcrumbSetting = "tree.breadcrumb" // TreeBreadcrumbAncestorsSetting is how many of the nearest hidden // ancestors the breadcrumb names (default 2); farther ones fold into // "…". 0 names them all. TreeBreadcrumbAncestorsSetting = "tree.breadcrumb.ancestors" )
The tree zoom settings, rows of settings/ochazuke.json.
const ( TreeZoomManual = "manual" TreeZoomAuto = "auto" TreeZoomOff = "off" TreeZoomRootCrumb = "crumb" TreeZoomRootRow = "row" TreeBreadcrumbLine = "line" TreeBreadcrumbTitle = "title" TreeBreadcrumbOff = "off" )
The tree zoom setting values.
const ( UINotice = "notice" UIClearNotice = "clear" UIError = "status" UIInfo = "info" )
UI message kinds. The status line is one line with two tones: UIError is the error tone (Ctx.Error; the TUI draws "Error: TEXT" in the error style, the CLI prints "error: TEXT") and UIInfo the neutral one (Ctx.Info: plain text before the hints, "status: TEXT" on the CLI). Either replaces the other. The kind strings are wire values (Response.Messages), so UIError keeps its old wire value "status".
const ActionsFile = "actions.json"
ActionsFile is the user actions file in the config directory, beside bindings.json.
const AliasShadowSetting = "aliases.shadow"
AliasShadowSetting says whether a bare alias may take the name of a verb (a typed word): refuse (the default: such an alias row is skipped and reported) or allow (the alias loads and, typed alone, wins over the verb of that name; the verb stays reachable as noun verb).
const AnyParameterType = "any"
AnyParameterType is the Parameter.Type of a value of any type: a word from the CLI or the palette arrives as text, an API request's value as it was sent, and the handler types it (a standard verb's prop value, propValue).
const AppNoun = "app"
AppNoun is the noun of the application as a whole (app.quit). It is never namespaced.
const ArgsFormID = "args-form"
ArgsFormID is the args form's modal instance (one at a time).
const BindingsHeader = `` /* 199-byte string literal not displayed */
BindingsHeader is the one comment line FormatBindings starts a file with.
const CancelKey = "esc"
CancelKey is the key every key-sequence prefix answers with mode.leave: a default row "<prefix> esc" is kept in each table that binds a sequence, so Escape cancels a pending prefix without running anything and the resolver never names a key.
const ChoicesCursorParameter = "cursor"
ChoicesCursorParameter is the parameter a rest parameter's choices source declares to see where the cursor is in the text (a rune offset into the query); without it the cursor is at the end.
const ChoicesQueryParameter = "query"
ChoicesQueryParameter is the parameter a choices source declares to see the typed text: a source verb with a parameter of this name is called with what the user has typed so far (the word in the palette, the query in a form's suggestions chooser, the value being checked), so it can complete as you type; one without it is called with no arguments.
const ChooserPreviewMin = 60
ChooserPreviewMin is the width from which a chooser with a Preview draws it beside the rows.
const ChooserStableHeightSetting = "chooser.stable-height"
ChooserStableHeightSetting keeps an open chooser at the height it reached (settings/ochazuke.json).
const ClipboardSetting = "clipboard"
ClipboardSetting says which yanks also go to the system clipboard (Registers.Copy): none (only the clipboard register "+), yanks (every yank, not a delete: the default) or unnamed (every yank and delete, as Vim's clipboard=unnamed).
const ColumnWidthStep = 2
ColumnWidthStep is the cells z > and z < add to or take from a column.
const CompletionNoun = "ochazuke.completion"
CompletionNoun is the noun whose rows answer while suggestions are open.
const DefaultArchiveConfirm = "Archive {{noun}} {{label}}? (delete it again to delete it for good)"
DefaultArchiveConfirm is what a standard delete asks instead when it will only archive the thing (delete.archive): the confirm says what happens. delete.archive-confirm off archives without asking.
const DefaultBindingTimeout = 1000 * time.Millisecond
DefaultBindingTimeout was the key-sequence timeout before the sequence-timeout setting, whose default (0, wait until a key comes) is in settings/ochazuke.json. Nothing in ochazuke reads it.
Deprecated: read or set the sequence-timeout setting (SequenceTimeoutSetting), or set Runtime.BindingTimeout in code.
const DefaultCompletionDebounce = 150 * time.Millisecond
DefaultCompletionDebounce is the pause after the last edit before an input's search is asked.
const DefaultDeleteConfirm = "Delete {{noun}} {{label}}?"
DefaultDeleteConfirm is the prompt a standard delete asks before it runs unless the store names its own (Store.Confirm["delete"]; "" asks nothing): a delete is never silent.
const DefaultRecordDebounce = DefaultTreeDebounce
DefaultRecordDebounce is how long typing in a field pauses before the record is written.
const DefaultTreeDebounce = 400 * time.Millisecond
DefaultTreeDebounce is how long typing in an outline line pauses before the line is written.
const ( // DocsShowConfigSetting adds the user's "yours:" lines to the docs // viewer's pages (default on); off, a page reads as the committed // file below its header. DocsShowConfigSetting = "docs.show-config" )
The docs noun's setting and the viewer.
const FitFollowsCursorSetting = "table.fit-follows-cursor"
FitFollowsCursorSetting is the setting that makes a cell-mode table's current column fit its content as the cursor moves (default off).
const FocusDisplaySetting = "focus-display"
FocusDisplaySetting is the framework setting that shows where the focus is left of the mode badge in the header: off (the default) leaves the chrome as it was, noun shows the focused instance's noun (pane NORMAL), stack the focus path from the outermost level to the innermost, open modals included (panes › pane-list › pane NORMAL). A row of settings/ochazuke.json, declared when the runtime is made; read at every frame, so a change (settings set, the Settings page, the focus.display verb, another process's write) shows on the next one.
const FocusLabelMax = 16
FocusLabelMax is the widest label (in cells) the stack shows for a level; a level with a longer label, or none, shows its noun.
const FormsOutsideWriteSetting = "forms.outside-write"
FormsOutsideWriteSetting says what an open record editor does when its record is written from outside it (RecordSpec.Watch, Reload): reload (the default) takes the new values and stays open, focus, field and mode kept, a field with unsaved typing keeping the typing; close leaves the editor (e edits again), as before.
const FrameworkBindingsSource = "ochazuke/"
FrameworkBindingsSource is the source prefix of the framework's embedded files in bindings defaults ("ochazuke/bindings/list.json").
const FrameworkNamespace = "ochazuke"
FrameworkNamespace is the namespace of the framework's own nouns: every noun the framework registers (inside Runtime.Builtin) is named ochazuke.<noun> (ochazuke.settings, ochazuke.list, ochazuke.page), with the short name (settings) as an alias. The app noun itself keeps its name (AppNoun), so its verbs (app.quit, an application's app.state) never collide with a framework noun.
const HelpInsertKey = "ctrl+\\"
HelpInsertKey opens the bindings help in insert mode, where ? types itself: an app row NewModel adds beside ? in normal mode. ctrl+\ is bound by no Readline default, no editor, palette, chooser, completion, filter, form or outline row, and the terminal is in raw mode, so it sends no SIGQUIT.
const HintsShowHiddenSetting = "help.hints-hidden"
HintsShowHiddenSetting puts the rows marked hidden (the editor's insert keys, the palette key, counts, registers) on the hint lines too; off by default, they are left to ? help and bindings list.
const HistoryFetchLimit = 100
HistoryFetchLimit bounds the fetches the ring keeps apart from the user's actions and changes, so a host polling a state verb never pushes those out.
const HistoryFetchesSetting = "history-fetches"
HistoryFetchesSetting is the declared boolean setting that lets the history file keep fetches (entries of kind fetch the user did not type into the palette). Off by default: a host polling a state verb would fill the file and push the user's own entries out of it, and nothing reads a fetch back after a restart.
const HistoryFile = "history.jsonl"
HistoryFile is the action history file in the state directory.
const HistoryLimit = 500
HistoryLimit bounds the action history ring.
const HistorySetting = "history-limit"
HistorySetting is the declared setting that bounds the history file (and the ring while it is persisted): the last N entries are kept; 0 writes and reads no file.
const ImplicitGuard = "input"
ImplicitGuard is the guard the framework puts on every editor noun row that runs an input operation (input.cancel aside): such a row answers only while the focus is an input itself, not a non-input instance an application parented under one. It is the framework's, not the user's: it is not part of a row's identity, so a row without when replaces or unbinds the default it shadows, and a user row that runs an input operation on the editor noun gets it too, as the default it replaces had.
const InputWritableGuard = "input-writable"
InputWritableGuard is the verb guard of the editor's editing verbs (insert, replace, delete, kill, paste, begin, undo, redo): false while the focus is a read-only input.
const JobLinger = 4 * time.Second
JobLinger is how long a finished job stays on the ticker after the frame that first saw it finished. The Model schedules one JobLingerMsg for the earliest remembered finish (Model.lingerCommand), so the row goes on an idle screen; any earlier frame past the deadline drops it too, and a newer job can push it off sooner.
const JobTickerRows = 2
JobTickerRows is the most entries the jobs ticker shows; they ride the rule line above the footer (Layout.TickerRule), so the ticker takes no row of its own.
const ListFilterMode = "list_filter"
ListFilterMode is the mode the filter line is typed in.
const MissingOpensFormSetting = "palette.missing-opens-form"
MissingOpensFormSetting says whether a request missing a required argument, run from the palette's enter or from a key, opens the args form (on, the default) instead of naming the first missing word.
const ModalAnchorSetting = "modal.anchor"
ModalAnchorSetting turns anchored modals on (the default) or off. A modal opened for something drawn on the page (Payload.Anchor: a form field's chooser) is drawn beside it, sized to its content, so the thing it is for and the lines around it stay visible; off, or when the screen leaves no room, it is centered as every other modal.
const ModeBadgeKeyCaseSetting = "mode-badge.key-case"
ModeBadgeKeyCaseSetting is the framework setting that sets the case of the keys a pending mode holds in the mode badge (R2.10): upper (the default, NORMAL G for both g and G) or as-typed (NORMAL g, NORMAL G, LEADER PENDING ctrl+a). The mode's name is upper case either way. A row of settings/ochazuke.json, read at every frame.
const ModeBadgeWidthSetting = "mode-badge.width"
ModeBadgeWidthSetting is the framework setting that sets the cells the mode badge reserves (R2.10): widest (the default) pads every label to the widest base mode's name, so the badge keeps both edges as the mode changes; fit draws each label in its own cells, so only its right edge stays. Either way the badge is the right end of the title row. A row of settings/ochazuke.json, read at every frame.
const MovementSection = "movement"
MovementSection is the help section that holds every motion, after the app's rows.
const NoopAction = "ochazuke.key.ignore"
NoopAction is the always-available action that does nothing: a row bound to it consumes its key (KeyConsumed), which is how a container clamps a key its children leave unhandled at an edge.
const NounPlaceLimit = 2000
NounPlaceLimit bounds the placements kept, in memory and in the file: past it the least recently seen one is dropped.
const NounPlaceWriteEvery = 2 * time.Second
NounPlaceWriteEvery is the least time between two writes of the placements file while the Model runs; Config.Flush (on quit) writes what is left.
const NounPlacesFile = "noun-places.json"
NounPlacesFile is the record of where each noun was seen, in the state directory: a JSON array of NounPlace, most recently seen first.
const NounsDisplaySetting = "nouns.display"
NounsDisplaySetting says which name DisplayNoun draws a noun by.
const OperatorWritableGuard = "input-operator-writable"
OperatorWritableGuard is input.operator's: false while the focus is a read-only input and the request applies an operator that changes the text to the visual selection (a visual mode's d, c, x: no motion), so those rows stand aside and leave the hints. An operator over a motion (d w, d d) stays available, and the handler leaves it a no-op; the editor's normal c and d rows carry input-writable as their row guard, so a read-only input never enters operator pending for them and the hint line does not offer them (y still does).
const PagesHiddenSetting = "pages.hidden"
PagesHiddenSetting is the framework setting that hides pages from the tab row and the page-cycling keys (page.next, page.previous, ctrl+j/k): a list of page ids. A hidden page stays registered and reachable: page.open, the page picker (marked hidden), the palette, the CLI and an application's own OpenPage still open it, and while it is current its tab shows so the chrome says where the focus is. Its default is the ids of the pages declared hidden by default (Page.DefaultHidden, the DefaultHidden option, a catalog page's defaultHidden), so an application's opt-in pages start hidden. Once settings.json holds a value it is the whole list; settings reset pages.hidden goes back to the application's defaults. It is read at every frame and every page motion, so settings set, page.hide, page.show, config.reload and another process's write apply on the next one.
const PaletteChoiceWordsSetting = "palette.choice-words"
PaletteChoiceWordsSetting says whether the palette offers a choice's own word (Choice.Word, a page's title) or its id.
const PaletteNamespaceWordsSetting = "palette.namespace-words"
PaletteNamespaceWordsSetting turns the namespace words (json doc for json.doc) on.
const PaletteNounTailsSetting = "palette.noun-tails"
PaletteNounTailsSetting turns the tail reading (doc for json.doc) on.
const PaletteTextResultsSetting = "palette.text-results"
PaletteTextResultsSetting says how the palette shows a text result: editor, all or plain (settings/ochazuke.json).
const PanesFile = "panes.json"
PanesFile is the remembered pane dividers in the state directory: an object of page id to Layout.Shift.
const PathChooserKind = "path-chooser"
PathChooserKind is the path chooser's modal kind; the source last used is remembered under it.
const PathParameterType = "path"
PathParameterType is the Parameter.Type of a path.
const PropObject = "object"
PropObject is the prop type of a JSON object (map[string]any). The other prop types are the setting types (SettingString, SettingInteger, SettingNumber, SettingBoolean, SettingDuration, SettingList), parsed the same way: a word such as "3", "true" or "400ms", a JSON array or object.
const ReferenceDir = "reference"
ReferenceDir is the directory config.export writes to by default, inside the config directory.
const ResultText = "text"
ResultText is the Operation.Result of a verb whose answer is text to read and copy (a jq program, a JSON mapping), set by NounBuilder.TextResult. The palette shows such an answer in the text view (palette.text-results); the CLI and the API return the value as they return any other.
const SearchCaseSetting = "search.case"
SearchCaseSetting is how searches treat case: SearchCaseSmart (the default), SearchCaseIgnore or SearchCaseSensitive. A row of settings/ochazuke.json.
const SelectedBackgroundSetting = "tones.selected-background"
SelectedBackgroundSetting says how the selected row draws a run with a tone background: drop (the default: the row stays one reverse bar, the background left out as the colour is) or keep (the run keeps its background and colour, bold, out of the reverse bar, so an error cell still reads as one on the selected row).
const SettingsPoll = time.Second
SettingsPoll is how often a Model checks settings.json for a change another process made (the CLI's settings set).
const SinglePathSetting = "forms.single-path"
SinglePathSetting says what a request whose only missing required argument is a path opens (R7.8): SinglePathChooser (the default) the path chooser at once, its pick running the request, optional parameters left out; SinglePathAlone the same only when the path is the form's one field (with optional parameters, the form); SinglePathForm always the args form. A form that opens on a missing path field of the picker kind opens its chooser over it, so typing reaches the path.
const TablesFile = "tables.json"
TablesFile is the remembered table views in the state directory: an object of table id (a list's, a grid's) to TableState.
const TerminalLeaderTimeoutSetting = "terminal-leader-timeout"
TerminalLeaderTimeoutSetting is the old name of sequence-timeout, which now governs the terminal leader as every other pending sequence: settings.get/set/reset, a declaration and a settings.json key under this name read and write sequence-timeout, warning once.
Deprecated: use SequenceTimeoutSetting.
const TextViewID = "text-view"
TextViewID is the text view's modal: the instance id and, canonical as ochazuke.text-view, its noun.
const TextViewNoun = "ochazuke.text-view"
TextViewNoun is the text view modal's noun (q closes it).
const ThemeSetting = "theme"
ThemeSetting is the declared setting that selects the colour scheme.
const ThemesFile = "themes.json"
ThemesFile is the user colour schemes file in the config directory.
const TimelineBodyNoun = "ochazuke.timeline-body"
TimelineBodyNoun is the noun of a timeline's body: the place inside the selected card while the focus walks its steps.
const TimelineCardNoun = "ochazuke.timeline-card"
TimelineCardNoun is the noun of a card that names none.
const TreeRowNoun = "ochazuke.outline-row"
TreeRowNoun is the noun of a node that names none: enter toggles it.
const UIStatus = UIError
UIStatus is the error tone's message kind.
Deprecated: use UIError (the same wire value, "status").
const UndoGuard = "history-undoable"
UndoGuard is the guard history.undo is available under: the newest entry holding changes can be undone (undoable), or, with none, some noun's store declares Undo.
const YankReportSetting = "yank.report"
YankReportSetting names the setting that has an editor's yank say what it copied on the status line (yankReport).
Variables ¶
var BuiltinThemes = []string{"adaptive", "dark", "light", "mono"}
BuiltinThemes are the schemes every application has: adaptive follows the terminal's background, dark and light fix it, mono draws no colour.
var ChromeLevels = []string{ChromeOff, ChromeSubtle, ChromeRich}
ChromeLevels are chrome.color's values.
var FocusDisplayModes = []string{FocusDisplayOff, FocusDisplayNoun, FocusDisplayStack}
FocusDisplayModes are focus-display's values, in cycle order.
var KeyEchoPlacements = []string{KeyEchoOff, KeyEchoFooter, KeyEchoBadge}
KeyEchoPlacements are keys.echo's values, in cycle order.
var ModeBadgeKeyCases = []string{ModeBadgeKeysUpper, ModeBadgeKeysAsTyped}
ModeBadgeKeyCases are mode-badge.key-case's values.
var ModeBadgeWidths = []string{ModeBadgeWidthWidest, ModeBadgeWidthFit}
ModeBadgeWidths are mode-badge.width's values.
Functions ¶
func BindingHints ¶
BindingHints renders the rows a focus answers to in its current mode as a hint line, from the innermost level outward (the focused instance's rows, its noun's, then its parents' up to the page and app): "enter demo.open · : palette.open · ? bindings.help". Motions (Operation.Motion) and hidden rows (counts, registers, macros, ctrl+c) are left to ? help, except a motion row with its own Hint (J reads "J/K detail"; a hint that starts with the row's key and a slash is shown alone), and of rows that run the same request only the first (innermost) key is shown. It is the data bindings.list prints, so a hint never names a key that is not bound; the descriptions are in BindingHelp (the ? modal).
func Call ¶
Call runs q in the application listening on the socket at path and returns its result (CallResponse keeps the messages too).
func ComposeModal ¶
ComposeModal centers a content-sized panel over the existing page, not a blank screen. Body and backdrop may contain trusted ANSI; title and footer are raw labels.
func DecodeJSONC ¶ added in v0.33.0
DecodeJSONC decodes a JSONC document into v. A syntax error or a value of the wrong type names its line and column in data.
func DefaultTones ¶ added in v0.26.0
DefaultTones are the built-in tones and how the built-in themes draw them, a copy.
func FitFocusPath ¶ added in v0.20.0
FitFocusPath joins levels with " › " in at most width cells. When they do not fit, it cuts from the left a whole level at a time behind "… › ", keeping the innermost level; with less room the innermost level alone follows "…", cut from its left when it is wider still. A cut path always starts with "…". Width under 1 is "".
func FormatBindings ¶ added in v0.33.0
func FormatBindings(doc BindingsDoc) ([]byte, error)
FormatBindings writes doc in the grouped format: the BindingsHeader line, then "modes" (names sorted, one per line) when there are any, then "bindings" with one group per table in doc order, its rows one per line in table order (a key repeats where the table repeats it). A row is an object with its fields in the order key, action, args, hint, when, from, hidden, help, replay, capture, target, confirmed, unbind.
func FormatRows ¶ added in v0.33.0
FormatRows writes any JSON array of rows (a slice of structs or objects) one row per line, as FormatBindingRows does, each row's fields in their marshalled order (a struct's declaration order).
func FormatRowsJSON ¶ added in v0.33.0
FormatRowsJSON rewrites a JSON array one element per line, keeping each element's key order; an error when data is not a JSON array.
func InputView ¶
InputView renders an input's visible text without a cursor, for inputs that are not focused. See InputBlock.
func JobsTicker ¶
JobsTicker renders the ticker's entries: one message per job, "noun.verb state" ("noun.verb label state" when the job has a Label), with ": error" on a failure, each truncated to width (Layout.TickerRule joins them into the rule line).
func JoinHints ¶ added in v0.59.0
JoinHints is the hint line of cells as plain text, BindingHints' form.
func ListHash ¶ added in v0.53.0
ListHash is a list's content hash: SHA-256 (128 bits, hex) of its record hashes in order, one per line. An empty list hashes too.
func MatchModes ¶ added in v0.59.0
func MatchModes() []string
MatchModes lists the match modes in cycle order.
func ModalSize ¶
ModalSize returns safe body bounds, reserving the same chrome as ComposeModal. Modal chrome uses one horizontal padding cell regardless of page density.
func MotionScroll ¶ added in v0.32.0
MotionScroll is the scroll a motion makes in a view page lines tall when reaching its target would scroll want lines (down when positive): want itself when it is at most half the page, else half the page (at least one line) toward it.
func Namespaced ¶ added in v0.16.0
Namespaced is name under namespace: "ai" and "skills" give "ai.skills"; an empty namespace is name unchanged.
func NextMatch ¶ added in v0.59.0
NextMatch is the mode step places after mode in the cycle (negative steps go back), wrapping; an unknown mode counts as substring.
func PanelContentSize ¶
PanelContentSize returns the body cells available inside a Panel, excluding its border and horizontal padding. Tiny panels omit their chrome.
func ParseSchemes ¶ added in v0.2.0
ParseSchemes reads colour schemes in the themes.json shape, an object of schemes by name:
{"kombu": {"background": "dark", "accent": "#C9A227",
"error": {"light": "#B3261E", "dark": "#FF8A80"},
"tones": {"state.working": {"fg": "#5FAFD7", "bold": true}}},
"dark": {"tones": {"build.cached": "muted"}}}
A role left out takes the built-in palette's; "tones" (ToneStyle by tone name) are laid over the built-in tones. An entry named after a built-in theme holds only "tones": they override and add to that theme's (adaptive's reach dark and light too). A scheme that does not validate (an unknown role, a bad colour, background or tone, a built-in's name with anything but tones, an error colour equal to the accent or muted one) is skipped and reported; a file that is not a JSON object yields no schemes.
func RecordHash ¶ added in v0.53.0
RecordHash is a record's hash: SHA-256 (128 bits, hex) of its encoded line, surrounding space trimmed. The state delta protocol hashes row lines with it (cli.RecordHash) and watch hashes things.
func RegisterInputOperations ¶
func RegisterInputOperations(r *Runtime)
func SegmentSetting ¶ added in v0.36.0
SegmentSetting is the setting that shows or hides one segment.
func SortBindings ¶ added in v0.15.0
func SortBindings(rows []Binding)
SortBindings orders rows the way the full export (bindings.list --all, bindings.reference.json) prints them: by mode (the any-mode rows, mode "", first), then by noun, a noun's rows before an instance's of the same name, then by the request's verb (a row with no verb, an unbind, after every verb), then by keys, a pattern row after the key rows; stable, so rows equal on all of these keep their stored order.
func SpanInView ¶ added in v0.32.0
SpanInView reports whether any of lines from through to (relative to the view's first line) is inside a view page lines tall.
func SplitKey ¶ added in v0.16.0
SplitKey splits an operation key on its last dot: the noun before it (a noun may be dotted: ochazuke.settings, ai.skills) and the verb after it. It is the reading of a name nothing is registered under; a registered name splits where it was declared (a verb may hold a dot: dirs.base.add), which Runtime.CanonicalKey and the request lookup read from the table. A key with no dot is all noun and no verb.
func SplitKeys ¶ added in v0.27.0
SplitKeys splits a key sequence into its prefix and its final key: "z l" is "z" and "l", "ctrl+a v" is "ctrl+a" and "v", "g c x" is "g c" and "x"; a single key (or a pattern, "<digit>") has no prefix.
func StandardVerbs ¶ added in v0.52.0
func StandardVerbs() []string
StandardVerbs lists the verbs of the standard verb table, in order.
func StandardizeJSONC ¶ added in v0.33.0
StandardizeJSONC is data as standard JSON: each comment and trailing comma becomes spaces, so every byte offset (and so every line and column) is the original file's. Plain JSON is returned as is, without a copy. A file that is not JSONC is an error naming its line and column.
func TableText ¶ added in v0.2.0
TableText lays a table out as plain text lines, the header line first, with the layout a list with columns draws (List.View) and no styling, gutter or highlight: a printer outside the TUI (the command line's --format table) reads the same column declarations. At width > 0 the columns that do not fit drop by Priority and cells cut with "…" at their width; at width <= 0 nothing drops or cuts, every column is as wide as its widest cell or title (Width and Min are ignored). A row with fewer cells than columns has empty ones; control characters in a cell become spaces; trailing spaces are trimmed. No columns is no lines.
Types ¶
type Action ¶ added in v0.2.0
type Action struct {
Noun string `json:"noun"`
Verb string `json:"verb"`
Description string `json:"description,omitempty"`
Command Argv `json:"command,omitempty"`
Base Argv `json:"base,omitempty"`
Call string `json:"call,omitempty"`
Target string `json:"target,omitempty"`
JSON bool `json:"json,omitempty"`
Label string `json:"label,omitempty"`
Confirm string `json:"confirm,omitempty"`
Parameters map[string]Parameter `json:"parameters,omitempty"`
Positional []string `json:"positional,omitempty"`
Dir string `json:"dir,omitempty"`
Timeout string `json:"timeout,omitempty"`
Quiet bool `json:"quiet,omitempty"`
History string `json:"history,omitempty"`
// Foreground gives the command the terminal (Foreground, foreground.go):
// the TUI suspends while it runs (o-csv FILE, an editor) and its exit
// status is told the user; no timeout, no captured output.
Foreground bool `json:"foreground,omitempty"`
// contains filtered or unexported fields
}
Action is one entry of actions.json: a verb on an existing noun that runs an external command. It becomes an application operation (noun.verb) like any other, so binding rows, the palette, the CLI, ? help and the catalog see it; its work runs off the loop as a job labelled Label, and the command's standard output is the job's result (JSON when it parses, a JSON value per line when every line does, else the text).
The command is either Command, an argv template run directly (never through a shell), or Base, the convention for a CLI with a JSON form: BASE NOUN VERB --json ARGS [--target TARGET], where NOUN VERB is Call ("noun verb", default this action's noun and verb), ARGS the action's arguments as one JSON object and TARGET the Target template when it is not empty. JSON appends --json ARGS to a Command too.
Templates ({{name}}) in Command, Base, Label, Dir and Target expand to: target or id (the instance the verb runs on), label (its label, else its id), noun and verb (the action's), data (the instance's Data: a string as is, else JSON), data.KEY (one field of Data as a JSON object), args (the arguments as JSON) or a declared parameter's value. An argv element that is exactly one placeholder and expands to nothing is left out, so an optional parameter disappears instead of passing "". Confirm is a confirm prompt template, as NounBuilder.Confirm takes. History is the kind of history entry it records (Operation.HistoryKind): "fetch" for a command that only reads; empty is a change, as for any application verb.
Actions are read only from the user's own actions.json (Config.Path): never from a catalog, a binding row, a socket call or an application's data, so nothing but the user's file decides what runs.
An entry with an "alias" field is an alias row instead (AliasRow): one more name for an existing action, which runs nothing of its own.
type ActionAlias ¶ added in v0.28.0
type ActionAlias struct {
Alias string `json:"alias"`
Action string `json:"action"`
Noun string `json:"noun,omitempty"`
Verb string `json:"verb,omitempty"`
Since string `json:"since,omitempty"`
RemoveAfter string `json:"removeAfter,omitempty"`
Note string `json:"note,omitempty"`
Source string `json:"source,omitempty"`
Args Arguments `json:"args,omitempty"`
Bare bool `json:"bare,omitempty"`
Shadows bool `json:"shadows,omitempty"`
Palette bool `json:"palette,omitempty"`
ParamAliases []ParamAlias `json:"paramAliases,omitempty"`
}
ActionAlias is one extra name of a registered action. Alias is the name (noun.verb, its noun canonical), Action the canonical key it runs. Noun and Verb are the alias's own noun and verb: the subject side the handler is told (Invocation). Since and RemoveAfter mark a deprecated alias, an old name kept for one release after a rename (Keep actions): its first use in a runtime posts a one-time notice naming the new name. Note is free text shown beside it. Args are preset arguments the alias runs its action with ({"force": true} for w!): a typed or bound argument of the same name wins. Presets may leave a required parameter out: it is asked for when the alias runs (the args form for a key or the palette, NAME is required for the CLI and the API). Bare marks an alias declared without a noun (w!, q): its noun is its action's, and the bare name alone reaches it in the palette, the CLI and the API (Request{Verb: "w!"}); a binding row names it by its full name (restructure.w!). Shadows marks a bare alias that may take the name of a verb and yields to it by what follows (set for settings.apply beside mode set): typed alone, or followed by words its action's rest parameter reads, it is the alias; followed by a noun that has the verb of its name, the line is that noun's verb (set mode normal is mode set normal). Its name is the bare word (set), since NOUN.VERB may be the verb it shadows. Palette keeps a bare alias to the command line inside the app: the CLI leaves the word to the shell's own commands, so bin help stays the shell's help while :help opens the docs viewer, which needs the TUI. ParamAliases are old names of its action's parameters the alias still takes (ParamAlias): --starred for --value on star.
func (ActionAlias) Deprecated ¶ added in v0.28.0
func (a ActionAlias) Deprecated() bool
Deprecated reports whether the alias is an old name on its way out.
func (ActionAlias) Name ¶ added in v0.43.0
func (a ActionAlias) Name() string
Name is how the alias is typed: its bare name, else noun.verb.
func (ActionAlias) ParamAlias ¶ added in v0.58.0
func (a ActionAlias) ParamAlias(name string) (ParamAlias, bool)
ParamAlias is the old parameter name the alias takes as name, false when name is none.
type AliasRow ¶ added in v0.28.0
type AliasRow struct {
Alias string `json:"alias"`
Action string `json:"action"`
Note string `json:"note,omitempty"`
Args Arguments `json:"args,omitempty"`
Shadows bool `json:"shadows,omitempty"`
Palette bool `json:"palette,omitempty"`
// ParamAliases are old names of the action's parameters the alias
// takes (ActionAlias.ParamAliases): "paramAliases": [{"alias":
// "starred", "param": "value"}].
ParamAliases []ParamAlias `json:"paramAliases,omitempty"`
}
AliasRow is an alias entry of actions.json: {"alias": "pane.k", "action": "pane.kill"} makes pane.k another name of pane.kill, for keys (bindings.json rows), the palette, the CLI and the API. Alias is noun.verb on a registered noun (a short noun name such as list works); Action is a registered action or alias. An alias may not take the name of an action or of another alias; such a row is skipped and reported, as bindings check reports a bad row. Note is free text listed with it. Shadows lets a bare alias take a verb's name and yield to it by what follows (ActionAlias.Shadows); Palette keeps a bare alias out of the CLI (ActionAlias.Palette).
type Align ¶
type Align string
Align is a column's alignment: AlignLeft (the zero value) or AlignRight.
type AppHandler ¶
AppHandler is the signature of an application verb: it reads the Ctx and returns Done, Failed or Pending work. Pending work runs off the loop; its completion is delivered to the owning instance through the contract, so a handler never blocks key handling.
type Appearance ¶
type Appearance struct {
Theme string `json:"theme"`
Density string `json:"density"`
Dark bool `json:"dark"`
Accent color.Color `json:"-"`
// Schemes are the colour schemes beyond the built-in themes, by name:
// the user's themes.json (Model.Init, themes.reload and config.reload set it) or an
// application's own (NewSchemeSet). A pointer keeps Appearance
// comparable.
Schemes *SchemeSet `json:"-"`
}
Appearance is event-loop-owned configuration. Operation results are value snapshots. Dark is the terminal background reported by tea.BackgroundColorMsg; the adaptive theme assumes a dark background until that message arrives.
Accent replaces the theme's accent colour when it is not nil: the title, panel and modal borders, the active tab, the badge and every highlight drawn in the accent take it, so an application can say "you are looking at everything" by colour alone (a pin state). Semantic colours (errors) and the muted text keep their meaning. The mono theme and NO_COLOR stay colourless. Applications set it in code; the appearance verbs leave it.
func NewAppearance ¶
func NewAppearance(r *Runtime) *Appearance
NewAppearance registers appearance operations once per runtime.
func (Appearance) Background ¶ added in v0.4.0
func (a Appearance) Background() (background string, plain bool)
Background is the background the appearance draws on, "light" or "dark" (an adaptive scheme follows Dark), and whether it draws no colour at all (the mono theme or NO_COLOR). A renderer with its own palette, such as the markdown package's Glamour styles, picks from it.
func (Appearance) ThemeNames ¶ added in v0.2.0
func (a Appearance) ThemeNames() []string
ThemeNames are the schemes Theme can name: the built-in themes, then the application's or user's (Schemes) by name.
type ArgumentError ¶ added in v0.1.1
type ArgumentError struct{ Err error }
ArgumentError is a request refused for its arguments (a missing required one, a wrong type, a value outside the enum or the source's choices) before any instance was chosen, so a caller never blames the target for it (the CLI adds no "pass --target" hint).
func (*ArgumentError) Error ¶ added in v0.1.1
func (e *ArgumentError) Error() string
func (*ArgumentError) Unwrap ¶ added in v0.1.1
func (e *ArgumentError) Unwrap() error
type Arguments ¶
Arguments are a request's named arguments, keyed by parameter name.
func ParseArguments ¶
ParseArguments parses the same JSON object used by the wire API.
type Argv ¶ added in v0.2.0
type Argv []string
Argv is a command line: a JSON array of words, or a string split on spaces (use the array for a word holding a space).
func (*Argv) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON reads an array of strings or one string split on spaces.
type BareReading ¶ added in v0.50.0
type BareReading struct {
Alias ActionAlias
Args Arguments
Skip int
Noun string
}
BareReading is how a command line that starts with a bare alias reads (ReadBareAlias): the alias and its presets, with the presets of any further bare aliases of the same action right after it (verbose set is settings.apply {verbose: true}), Skip the words they took; or, for an alias that shadows a verb, Noun: the line is that noun's verb of the alias's name (set mode normal is mode set normal).
type Binding ¶
type Binding struct {
// The field order is the bindings file's (BindingFieldOrder): mode,
// the noun or instance, the keys or pattern, the request, then the
// rest. FormatBindingRows writes a file in that order (and the
// request noun before verb); plain json.Marshal follows the
// declarations below.
Mode string `json:"mode,omitempty"`
Noun string `json:"noun,omitempty"`
Instance string `json:"instance,omitempty"`
Keys string `json:"keys,omitempty"`
Pattern string `json:"pattern,omitempty"`
Request Request `json:"request"`
When string `json:"when,omitempty"`
Unbind bool `json:"unbind,omitempty"`
From map[string]string `json:"from,omitempty"`
Replay bool `json:"replay,omitempty"`
Capture bool `json:"capture,omitempty"`
// Hint replaces "noun.verb: description" in the footer and the help
// for a row whose operation says nothing useful on its own (the
// terminal leader's mode.enter); bindings list carries it too.
Hint string `json:"hint,omitempty"`
// Hidden keeps the row off the footer's hint line (counts, registers,
// macros, ctrl+c); ? help and bindings list still show it.
Hidden bool `json:"hidden,omitempty"`
// Help replaces the operation's description in ? help and bindings
// list for a row whose operation is generic (mode.enter into a
// register, macro or count mode).
Help string `json:"help,omitempty"`
// Aliases are the other names of the row's operation, which bindings
// list adds so a row names its canonical operation and its aliases
// once; a stored row never holds them (a file's value is dropped).
Aliases []string `json:"aliases,omitempty"`
// contains filtered or unexported fields
}
Binding is one row of a mode table, identical in code and config: {noun | instance, mode, keys | pattern, request | null, from, when}. Keys is an exact key or a space-separated sequence ("g g"); Pattern is a key class: digit, alpha, printable, paste, any, a class minus keys ("alpha-q"), or a set ("one-of:h j k l"); upper is one uppercase letter and ctrl+alpha one ctrl+letter (ctrl+a to ctrl+z). From fills request arguments from the key or the mode payload (see Sources). When names a registered guard. A row's identity is its table (noun or instance), mode, keys or pattern and guard: a row replaces only the row with the same identity, so a row with When and the unguarded row on the same keys coexist, and Unbind removes only the row with the same identity (an unbind row without When removes the unguarded row, never a guarded one). The editor noun's implicit "input" guard is not part of the identity (see withImplicitGuard). Replay dispatches the key again, fresh, after the row ran (a pending mode that hands an unknown key back to the stack). Capture rows are consulted outer-first (app first) before the inner-first walk (see resolve.go).
A row is atomic: a Request (one registered operation, its arguments from the row, the key or the payload), a mode transition (Enter, Leave) or an unbind. There is no row that runs Go code with the key. Composite behaviour is an operation whose handler calls other operations through Execute (macro.record, terminal.paste under the leader); a condition is a named guard. TestBindingRowsAreAtomic pins this for every table.
func Enter ¶
Enter builds a row that enters a pending mode with a typed payload: the operator fields (Op, Count, OpCount) and, for a leader, Prefix (the key sequence the mode holds, which arms the sequence timer) and Request (what the timer runs when no second key arrives).
func HintBindings ¶ added in v0.16.0
HintBindings is the rows BindingHints shows, in its order: what a check of the footer presses to prove every hint answers.
func Leave ¶
func Leave() Binding
Leave builds a row that returns from a pending mode to the mode it shadowed.
func SetProp ¶ added in v0.53.0
SetProp builds a row that writes value to noun's prop (the file's {"key": KEY, "request": {"noun": NOUN, "prop": PROP, "value": VALUE}}).
func ToggleProp ¶ added in v0.53.0
ToggleProp builds a row that flips noun's boolean prop ({"request": {"noun": NOUN, "prop": PROP, "toggle": true}}).
func (Binding) Captured ¶
Captured marks a row as a capture row: consulted outer-first before the inner-first walk (config field "capture").
func (Binding) FromPayload ¶
FromPayload fills an argument from the mode payload (a Source name).
func (Binding) FromRow ¶ added in v0.3.0
FromRow fills an argument from the Data of the row the key acted on: the innermost instance carrying Data from the focus out to the level the row answered at (a list row's ListItem.Data, also when the row is bound on the list). field names a key of that value (a map's key, a struct's JSON field name; dots walk nested values, "repo.path"); "" passes the whole value. A struct is read through its JSON encoding, so the value is what the CLI would send (numbers float64, the whole row an object). A row without Data, or without the field, leaves the argument out. The source is "row:<field>" (or "row") in a binding file.
func (Binding) Hide ¶
Hide keeps the row off the footer (config field "hidden"); ? help and bindings list still show it.
type BindingGroup ¶ added in v0.33.0
type BindingGroup struct {
Noun string
Instance string
Mode string
Extends string
// Fallback ("fallback": true) keeps a default file's group to the keys
// its table did not bind before the file loaded (LoadDefaultBindings):
// an application's row bound earlier keeps its key.
Fallback bool
// Source ("source") is where the group's rows are declared, as
// bindings defaults writes it; a reader keeps it and nothing acts on it.
Source string
Rows []Binding
}
BindingGroup is one table of a grouped bindings file: a noun's or an instance's mode table and its rows in table order. Every row carries the group's Noun or Instance and Mode.
func GroupBindings ¶ added in v0.33.0
func GroupBindings(rows []Binding) []BindingGroup
GroupBindings groups rows into tables: nouns by name, then each noun's modes by name ("" first), then instances by ID and mode, each group's rows in their given order.
func (BindingGroup) Context ¶ added in v0.33.0
func (g BindingGroup) Context() string
Context is the group's "context" spelling, "noun/mode" or a bare noun; "" for an instance group.
type BindingTimeoutMsg ¶
type BindingTimeoutMsg struct {
// contains filtered or unexported fields
}
BindingTimeoutMsg resolves a pending key sequence on the owning event loop. Messages from an older sequence or another runtime are ignored.
type BindingsDoc ¶ added in v0.33.0
type BindingsDoc struct {
Modes map[string]ModeSpec
Groups []BindingGroup
}
BindingsDoc is a parsed bindings file: its modes and its groups, in file order. A rows-format file is one group per row run of the same table.
func ParseBindings ¶ added in v0.33.0
func ParseBindings(data []byte) (BindingsDoc, string, error)
ParseBindings reads a bindings file in either format (JSONC), with the format it found. A malformed file is an error with its line and column; a bad group or value is an error naming the group and key.
func (BindingsDoc) Rows ¶ added in v0.33.0
func (d BindingsDoc) Rows() []Binding
Rows are the doc's rows, group by group in file order.
type Block ¶
Block is the result of rendering. Text is trusted ANSI. Cursor is where the focused input's cursor sits inside Text, or nil when the block holds no focused input. Only the innermost focused component supplies a cursor; composers move it by where they placed the child and never invent one.
func ComposeModalBlock ¶
func ComposeModalBlock(background, title string, body Block, footer string, width, height int, styles Styles) Block
ComposeModalBlock is ComposeModal for a body that may carry a cursor. The result's cursor is the body's, moved to where the panel placed it; the backdrop never contributes one because a modal covers whatever it held.
func InputBlock ¶
InputBlock renders width x height cells of an input around its cursor and reports where the cursor sits, without changing text or editing state. Visual selections and an open select range are painted in reverse video (the visual-selection style); the cursor itself is left to the terminal, so compose this block only for the focused input.
func (Block) Clip ¶
Clip drops a cursor that fell outside a width x height cell area whose top-left corner is the block's origin, as when a composer clipped the child.
type CallMsg ¶
type CallMsg struct {
Request Request
Reply chan Response
// Stream asks for a watch (the watch verb's *Watch) live, as the
// result, for a caller that reads its events on the loop (the CLI
// shell); without it the result is the events so far and the watch
// ends.
Stream bool
}
CallMsg is delivered to the UI loop; only that loop may call Runtime.Execute.
type Card ¶ added in v0.17.0
type Card struct {
ID string `json:"id"`
Noun string `json:"noun,omitempty"`
Label string `json:"label,omitempty"`
Data any `json:"data,omitempty"`
Header string `json:"header"`
Meta string `json:"meta,omitempty"`
Body func(width int) string `json:"-"`
Sections []CardSection `json:"sections,omitempty"`
Steps []CardStep `json:"steps,omitempty"`
Open bool `json:"open,omitempty"`
Active bool `json:"active,omitempty"`
Muted bool `json:"muted,omitempty"`
Group string `json:"group,omitempty"`
Revision uint64 `json:"revision,omitempty"`
// Event draws the card as something that happened rather than
// something said: indented one level (eventIndent cells), its border
// dashed and muted until it is selected. A task's notification is one.
Event bool `json:"event,omitempty"`
// MetaTones tone runs of Meta (a status word, its glyph) as a list
// row's ToneSpan tones a cell: From and To are rune offsets into Meta
// (To 0: its end), Cell is not read, a later span wins where two
// overlap. A toned run draws in its tone's style instead of the muted
// meta style; the text never changes, so widths and copies are the
// same as without tones. An unknown tone draws muted, as the rest.
MetaTones []ToneSpan `json:"metaTones,omitempty"`
// Tone is a tone whose style draws the card's border (and the Active
// "●" in it) in place of the border role: a card whose state should
// be seen from across the timeline (a running turn, a failed one).
// The chrome row border.<tone> of the chrome.color level draws it when
// the level has one (chrome.rich.border.state.working), else the tone.
// The focused timeline's selected card keeps the accent, so the
// focus always reads; an unknown tone, or "", draws the usual border.
Tone string `json:"tone,omitempty"`
}
Card is one entry of a timeline: a box with a header that always shows (wrapped onto as many lines as it needs) and a meta line under it, and a body shown only while the card is open. Like a ListItem, a card is an instance of its noun (Noun, default TimelineCardNoun) under the timeline's list, so the app's verbs and rows on that noun answer on it and Data is what a verb reads as Ctx.Instance.Data. Label is the instance's label (palette, {{label}}, the / filter), default the header on one line.
Body and every section's Body are asked lazily, with the inner width, only while the card is open and drawn (or scrolled across); the result is kept until the width, the folds or Revision change, so an app bumps Revision whenever a body's text changes (a streaming answer). Open is the card's state the first time the timeline sees its id; after that the user's open and close follow the id. Active draws the card brighter (its header bold, a "●" in its top border, which reads in mono too); Muted draws its header and meta in the muted style (an older card). A card whose Group differs from the card above it is preceded by a full-width rule with the group as its label (a session boundary).
Steps are the places inside an open card that l steps onto and j/k walk (timeline_steps.go). A card with Steps draws its body from them, and Body and Sections are not drawn; a card without them steps through its Body's paragraphs (blank-line separated, a fenced code block one paragraph) and then each section, title and text, as one step.
type CardRole ¶ added in v0.17.0
type CardRole string
CardRole is the style a section's text draws in.
type CardSection ¶ added in v0.17.0
type CardSection struct {
Name string `json:"name,omitempty"`
Title string `json:"title"`
Summary string `json:"summary,omitempty"`
Role CardRole `json:"role,omitempty"`
Folded bool `json:"folded,omitempty"`
Body func(width int) string `json:"-"`
}
CardSection is one foldable part of an open card's body, drawn after Body: a title line ("▾ 2 thinking · Summary") and, unfolded, its text indented in its Role's style. Name keys its fold state (default the title, else its number); Folded is its state until the user folds it.
type CardStep ¶ added in v0.30.0
type CardStep struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Summary string `json:"summary,omitempty"`
Role CardRole `json:"role,omitempty"`
Folded bool `json:"folded,omitempty"`
Header bool `json:"header,omitempty"`
Paragraphs bool `json:"paragraphs,omitempty"`
Body func(width int) string `json:"-"`
}
CardStep is one place inside an open card (Card.Steps), in order.
- Header: the step is the card's header (a prompt): it draws nothing of its own, its lines are the header's and its text is Header.
- A Title draws a bold title line; with a Body the step folds like a section ("▾ 2 tool Bash · summary", z 2, timeline.fold {section} by ID, title or number), Folded its first state, and its body is indented under the title. Folded, the title is the whole step; l inside opens it.
- Paragraphs splits the Body into steps of its own, one per paragraph (blank-line separated, a fenced code block one paragraph); under a Title the title line belongs to the first.
- Without a Title the Body draws at the full width in Role.
Steps follow each other with a blank line between them, except two titled steps in a row (they stack as sections do). ID keys the fold.
type CaseMatch ¶ added in v0.55.0
type CaseMatch struct {
// contains filtered or unexported fields
}
CaseMatch is how one query compares with text: folded (case ignored) or exact. Build it with CaseFor or Runtime.CaseFor; the zero value matches exactly.
func CaseFor ¶ added in v0.55.0
CaseFor is the CaseMatch search.case value mode gives query: smart folds unless query holds an upper-case letter (unicode.IsUpper, so É counts and a separator or digit never does); ignore always folds; sensitive never does. An unknown mode reads as smart.
type Choice ¶
type Choice struct {
ID string `json:"id"`
Label string `json:"label"`
// Word is what the palette offers and takes for the choice when it is
// not the id ("" the id): a page's title for page open. Typed whole,
// the id still names it (palette.choice-words).
Word string `json:"word,omitempty"`
}
Choice is one value a parameter accepts: ID is the argument value, Label what a pick list shows.
func ParseChoices ¶
ParseChoices reads a source operation's result: []string, []Choice, []PaletteInstance, []Operation (the id is noun.verb), []map whose id is "id", else "key", else "name" and whose label is "label", else "title" (and word "word", Choice.Word), or []any of strings or such maps (the JSON-decoded form).
type Chooser ¶ added in v0.2.0
type Chooser struct {
// contains filtered or unexported fields
}
Chooser is one open chooser, the Component of its modal instance.
func (*Chooser) HandleMessage ¶ added in v0.2.0
The delivery contract: a chooser runs no jobs of its own (Choose and Create return their own results). Pending work they return belongs to the focus the chooser opened over (runApplication), since the chooser and its input are closed before the callback runs.
func (*Chooser) Highlighted ¶ added in v0.2.0
func (c *Chooser) Highlighted() (ChooserRow, bool)
Highlighted is the row Enter takes: the moved-to row, else the top match; none means Enter creates.
func (*Chooser) Loading ¶ added in v0.44.0
Loading reports whether the current source's load is in flight.
func (*Chooser) MatchMode ¶ added in v0.59.0
MatchMode is the chooser's match mode: the one search.cycle-match or search.set-match chose while it is open, else the chooser.match setting. It decides the default filter only (not a Filter of the application's own, not a Live source's own ranking).
func (*Chooser) Matches ¶ added in v0.2.0
func (c *Chooser) Matches() []ChooserRow
Matches are the rows the query keeps: matches first, then trailing rows, then the create row, then the fixed rows.
func (*Chooser) ModalBlock ¶ added in v0.2.0
func (*Chooser) ModalTitle ¶ added in v0.2.0
ModalTitle and ModalBlock make a chooser a self-drawing modal body (ModalBody), drawn like a record editor and its chooser.
func (*Chooser) Moved ¶ added in v0.2.0
Moved reports whether the user moved the highlight since the last edit.
func (*Chooser) PendingCommand ¶ added in v0.2.0
PendingCommand follows the query after every event: a Live source loads again for the edited query, and the work it queues is handed over here (the runtime's queue was drained before the components were asked).
func (*Chooser) SetQuery ¶ added in v0.44.0
SetQuery replaces the search text (cursor at its end), as typing would.
func (*Chooser) SetRows ¶ added in v0.2.0
func (c *Chooser) SetRows(rows []ChooserRow)
SetRows replaces the rows (a background load landing); the highlight stays on the same row id when the user had moved it.
func (*Chooser) Source ¶ added in v0.44.0
Source is the current source's name, "" for a chooser without sources.
func (*Chooser) Sources ¶ added in v0.44.0
Sources are the names of the chooser's sources, in order.
func (*Chooser) Title ¶ added in v0.2.0
Title is the chooser modal's title; with sources, the current source in brackets and the others after it.
func (*Chooser) View ¶ added in v0.2.0
View draws the search line, then the rows with the highlighted one in reverse video, with what Enter would create when nothing is highlighted after the matches (before the fixed rows); with a Preview and the width for it, the highlighted row's preview on the right. Its cursor is the search input's.
type ChooserRow ¶ added in v0.2.0
type ChooserRow struct {
ID string
Label string
Data any
Trailing bool
Fixed bool
// Cells, when set, draw the row as aligned columns (each column as
// wide as its widest cell among the rows); Label stays what the
// filter reads.
Cells []string
// Opens marks a row its source can open (ChooserSource.Open: a
// folder to browse into): chooser.open opens it, and so does enter
// unless the setting chooser.enter is "pick". NoPick marks a row that
// only opens (a folder in a file chooser): picking it opens it.
Opens bool
NoPick bool
// Refuse marks a row that cannot be picked and says why: picking it
// fails with Refuse and the chooser stays open (a typed path whose
// folder is missing, R7.8).
Refuse string
}
ChooserRow is one choice. Trailing rows (a "browse…" entry) follow the matches. Enter takes one without moving onto it only when the query is not empty and no ordinary row matches, so their filter should be strict (a substring of the label); an empty query with no ordinary rows creates. Fixed rows (a "no pin" entry) sit at the bottom whatever the query: the filter never sees them and Enter takes one only once the highlight is moved onto it, or when the query spells it.
type ChooserSource ¶ added in v0.44.0
type ChooserSource struct {
// Name is what the title calls the source ("browse", "recent").
Name string
// Label, when set, is what the title shows for the current source in
// place of Name ("browse ~/proj").
Label func() string
// Load lists the source's rows for the query: Done([]ChooserRow),
// Failed (the error is the empty line), or Pending work whose value is
// a []ChooserRow, run off the loop as a job of the chooser (a newer
// load replaces it; closing the chooser cancels it).
Load func(query string) Result
// Live sources match the query themselves: Load runs again on every
// edit and its rows are shown as they come, in their order. Other
// sources load once when they become current (and after Open or Up)
// and the chooser's Filter narrows their rows.
Live bool
// Empty is the line shown while the source has no rows ("no recent
// paths"); the spec's Empty (or "loading…" while a load runs) else.
Empty string
// Open navigates into a row marked Opens (browse into a folder) and
// returns the query to show next; false leaves everything as it is.
// The source then loads again.
Open func(row ChooserRow) (query string, ok bool)
// Up navigates back out (the parent folder) given the query and
// returns the query to show next; false when there is nowhere to go.
Up func(query string) (string, bool)
// Create and CreateLabel, when set, stand in for the spec's while the
// source is current (a browse source creates in its folder).
Create func(query string) Result
CreateLabel func(query string) string
// Keep, when set, stands in for the spec's Keep while the source is
// current: the cell columns cut last (a known-folder source's path,
// its branch and project columns narrowing first).
Keep []int
}
ChooserSource is one source of a chooser's rows.
type ChooserSpec ¶ added in v0.2.0
type ChooserSpec struct {
Kind string
Title string
Rows []ChooserRow
Filter func(query string, row ChooserRow) bool
Choose func(ChooserRow) Result
Create func(query string) Result
CreateLabel func(query string) string
CreateRow bool
Empty string
// Keep names the columns (indexes into ChooserRow.Cells) cut last when
// the cells do not fit (a directory chooser's path): the others narrow
// to their minimum first, then the kept ones, widest first.
Keep []int
// Preview, when set, draws the highlighted row's text beside the rows
// (wrapped, cut at the bottom) once the chooser is ChooserPreviewMin
// cells wide; narrower, the rows take the whole width.
Preview func(ChooserRow) string
// Sources, when set, supply the rows one source at a time (see
// ChooserSource; Rows is then the current source's). Source names
// the one to open on; else (or when this open has no source of that
// name) the one last used for the kind (chooser.remember-source),
// else the first.
Sources []ChooserSource
Source string
}
ChooserSpec opens a chooser. Kind is the modal's kind (one open chooser per kind). Title is the modal's title. Filter defaults to a fuzzy match on Label, case as the search.case setting says (CaseFor; a Filter of the application's own can read Runtime.CaseFor too); matches whose label holds the query whole come first, otherwise in Rows order. Create is optional; without it Enter on no match fails. CreateLabel names what Enter would create from the query. CreateRow shows that as a "+ <label>" row while the query is not empty, after the matches and trailing rows and before the fixed rows; typing never matches or ranks it, it is the default only when nothing else matches, and Enter on it creates. Empty is the line shown while there are no rows at all ("loading…"). Keep names the cell columns cut last. Preview draws a preview of the highlighted row beside the rows when there is room.
type Column ¶
type Column struct {
Title string `json:"title"`
Width int `json:"width,omitempty"`
Min int `json:"min,omitempty"`
Max int `json:"max,omitempty"`
Align Align `json:"align,omitempty"`
Priority int `json:"priority,omitempty"`
Wrap bool `json:"wrap,omitempty"`
Pinned bool `json:"pinned,omitempty"`
Group bool `json:"group,omitempty"`
}
Column is one column of a table. Width fixes the column's cells (0: a flexible column, as wide as its widest cell or title when there is room); Min is a flexible column's least width before columns drop (default: 10 cells or its title's width when wider, at most its widest cell or title). Priority orders dropping when the width is short: the column with the largest Priority drops first, ties the rightmost first; 0, the default, is the most important, and the last column left never drops (it is cut instead). Max caps a flexible column's growth (0: up to its widest cell). Wrap makes List.View wrap a cell longer than its column onto further lines of the row instead of cutting it: the row is as tall as its tallest wrapped cell, the other cells sit on its first line (TableText still cuts). Group makes List.View draw a cell blank when it repeats the cell above it in the same section (and every Group column left of it does too), so a run of rows sharing a value (the help's key prefix) shows it once; the first row a frame draws always shows its cells, and the rows' Cells keep the value (TableText does not blank).
type Completer ¶ added in v0.5.0
type Completer struct {
// Debounce is the pause before a search is asked
// (DefaultCompletionDebounce when 0).
Debounce time.Duration
// contains filtered or unexported fields
}
Completer is the inline completion component: which input it follows, the token whose suggestions are wanted and the answer on screen.
func (*Completer) Close ¶ added in v0.5.0
func (c *Completer) Close()
Close hides the list and cancels its searches.
func (*Completer) DebounceCurrent ¶ added in v0.5.0
func (c *Completer) DebounceCurrent(msg CompletionDebounceMsg) bool
DebounceCurrent reports whether a pause timer is for the latest request, whose search has not started yet.
func (*Completer) DebounceTick ¶ added in v0.5.0
func (c *Completer) DebounceTick() (CompletionDebounceMsg, bool)
DebounceTick is the pause timer in flight, for a host that delivers it at once (tests, o-story): false when no search is waiting on one.
func (*Completer) HandleMessage ¶ added in v0.5.0
HandleMessage starts a search when its pause ends and takes a search's answer.
func (*Completer) Highlighted ¶ added in v0.5.0
Highlighted is the highlighted suggestion's index, -1 for none.
func (*Completer) Input ¶ added in v0.5.0
Input is the input the list belongs to, "" when none is followed.
func (*Completer) Open ¶ added in v0.5.0
Open reports whether the suggestion list is shown (its rows answer).
func (*Completer) PendingCommand ¶ added in v0.5.0
PendingCommand looks at the focused input and schedules the pause timer of a new request.
func (*Completer) Searching ¶ added in v0.5.0
Searching reports whether a search newer than the answer on screen runs.
func (*Completer) Suggestions ¶ added in v0.5.0
func (c *Completer) Suggestions() []Suggestion
Suggestions are the answer on screen.
func (*Completer) Token ¶ added in v0.5.0
func (c *Completer) Token() (CompletionToken, bool)
Token is the token whose suggestions are wanted, and whether there is one.
type Completion ¶
Completion is the message off-loop work sends back. It is delivered to the owning instance only while its ticket is current.
type CompletionDebounceMsg ¶ added in v0.5.0
type CompletionDebounceMsg struct {
Seq uint64
}
CompletionDebounceMsg is the pause timer of one request: when it is the latest (Completer.DebounceCurrent) the search is started.
type CompletionQuery ¶ added in v0.44.0
type CompletionQuery struct {
Query string `json:"query"`
Text string `json:"text"`
Cursor int `json:"cursor"`
Token CompletionToken `json:"token"`
}
CompletionQuery is what a SearchAt search is asked: the query (the token after its trigger), the input's whole text, the cursor (a rune offset) and the token.
type CompletionSearch ¶ added in v0.5.0
type CompletionSearch func(ctx context.Context, query string) ([]Suggestion, error)
CompletionSearch answers a query, the token after its trigger, with suggestions. It runs off the loop, as a job; its context is cancelled when the answer can no longer be shown (the suggestions were dismissed, or a newer answer is already on screen). An error is shown in the list.
func SearchStrings ¶ added in v0.5.0
func SearchStrings(search func(ctx context.Context, query string) ([]string, error)) CompletionSearch
SearchStrings adapts a search that answers plain strings, for the usual case where what the list shows is what is inserted.
type CompletionToken ¶ added in v0.5.0
type CompletionToken struct {
Start int `json:"start"`
End int `json:"end"`
Trigger string `json:"trigger"`
Query string `json:"query"`
}
CompletionToken is the trigger token under an input's cursor: the rune range [Start, End) it covers, its trigger and its query (the token after the trigger).
func FindCompletionToken ¶ added in v0.5.0
FindCompletionToken finds the token holding the cursor in text and the index of the trigger it starts with. A token is a run of non-whitespace; it counts only when it starts with a trigger (the longest one, when triggers overlap) and the cursor is past that trigger, at the token's end or anywhere inside it.
func FindCompletionTokenIn ¶ added in v0.44.0
func FindCompletionTokenIn(text []rune, cursor int, triggers []CompletionTrigger) (CompletionToken, int, bool)
FindCompletionTokenIn is FindCompletionToken over full triggers: each trigger's token also ends at its Boundaries.
type CompletionTrigger ¶ added in v0.5.0
type CompletionTrigger struct {
Trigger string
Search CompletionSearch
// SearchAt, when set in place of Search, answers with the whole text
// and cursor as well as the query (CompletionQuery).
SearchAt func(ctx context.Context, q CompletionQuery) ([]Suggestion, error)
// DropTrigger makes accepting replace the trigger too: the
// suggestion's Text is all that stays (a "\" that only asks for a
// symbol). Off, the default, keeps it.
DropTrigger bool
// Boundaries are the characters besides whitespace that end a token
// (both ways), so the trigger can follow one directly: "|(,"
// lets a jq "." start after a pipe or an open paren. "" is
// whitespace only. They may not hold the trigger's characters.
Boundaries string
}
CompletionTrigger is one trigger of an input: the characters that start a completion token and the search that answers its query.
type Component ¶
Component is the delivery contract every instance that works off the loop implements through Instance.Component. HandleMessage applies a result on the loop and reports whether the message was for this component; PendingCommand hands the Bubble Tea adapter the work scheduled since the last drain; Close cancels outstanding work and releases anything held. The picker and the registers component are the framework's own; an application adds its own by setting Instance.Component.
type Config ¶ added in v0.2.0
type Config struct {
App string
Dir string
// Report, when set, receives every problem as it is found: a bindings
// row that was skipped, a file that does not parse, an unknown or
// invalid setting. NewModel sets it to Model.Notify, so problems are
// persistent footer notices.
Report func(problem string)
// Withdraw, when set, takes back a problem Report sent once it no
// longer holds (bindings.reload of a fixed file); NewModel sets it to
// drop the notice.
Withdraw func(problem string)
// StateDir, when set, is the state directory (the history file);
// else $XDG_STATE_HOME/<App>, else ~/.local/state/<App>.
StateDir string
// NoHistoryFile keeps the action history in memory only: an
// application opts out of history.jsonl.
NoHistoryFile bool
// contains filtered or unexported fields
}
Config is the application's per-user configuration directory and what the framework loaded from it: the user bindings file (bindings.json, rows in the bindings.load shape that replace or unbind the defaults by noun, mode and keys) and the declared settings (settings.json). It is one instance under app, reached through Runtime.Config(), never a Runtime field.
The directory is Dir when set, else $XDG_CONFIG_HOME/<App>, else ~/.config/<App>. App defaults to the binary's name (a test binary, NAME.test, has none), so every application gets the files without code; an application whose directory is named otherwise sets App before the Model starts (mtm sets "matomeru"). With App and Dir both empty there is no directory: nothing is read or written.
func (*Config) ActionProblems ¶ added in v0.2.0
ActionProblems are the problems the last read of actions.json found.
func (*Config) BindingProblems ¶ added in v0.2.0
BindingProblems are the problems the last load of the user bindings found (rows skipped, a file that does not parse).
func (*Config) BindingsFormat ¶ added in v0.33.0
BindingsFormat is the format the last read of bindings.json found: BindingsGrouped, BindingsRows, or "" when there was no file.
func (*Config) Close ¶ added in v0.2.0
func (c *Config) Close()
Close keeps everything: the config lives as long as the runtime.
func (*Config) Directory ¶ added in v0.2.0
Directory is the config directory, "" when there is none.
func (*Config) Disable ¶ added in v0.2.0
func (c *Config) Disable()
Disable gives the runtime no config directory (App and Dir empty): a sandbox such as an o-story session reads and writes no user files, and keeps no history file.
func (*Config) Flush ¶ added in v0.2.0
Flush stops the history writer once every line sent to it is written, and writes the placements record (NounPlacesFile) and stops its writer. The Model calls it on quit; later requests are not persisted.
func (*Config) FrameworkTheme ¶ added in v0.2.0
FrameworkTheme reports whether the theme setting is the framework's (the Model applies it to Appearance.Theme) rather than the application's own.
func (*Config) HandleMessage ¶ added in v0.2.0
HandleMessage: the config does no off-loop work.
func (*Config) HistoryPath ¶ added in v0.2.0
HistoryPath is the history file, "" when the history is not persisted (no state directory, or the application set NoHistoryFile).
func (*Config) NounPlacesPath ¶ added in v0.15.0
NounPlacesPath is the placements file, "" when placements are not persisted (no state directory: Config.Disable, a test binary).
func (*Config) PanesPath ¶ added in v0.4.0
PanesPath is the panes file, "" when dividers are not persisted (no state directory: Config.Disable, a test binary).
func (*Config) Path ¶ added in v0.2.0
Path is a file in the config directory, "" when there is none.
func (*Config) Paths ¶ added in v0.6.0
func (c *Config) Paths() ConfigPaths
Paths are the config, state and default reference directories.
func (*Config) PendingCommand ¶ added in v0.2.0
PendingCommand: nothing is ever scheduled.
func (*Config) Schemes ¶ added in v0.2.0
Schemes are the user's colour schemes from themes.json, by name, as the last read found them (EnsureConfigSettings, themes.reload).
func (*Config) StateDirectory ¶ added in v0.2.0
StateDirectory is the application's state directory, "" when there is none: StateDir when set, else $XDG_STATE_HOME/<App>, else ~/.local/state/<App>. Disable leaves none.
func (*Config) TablesPath ¶ added in v0.12.0
TablesPath is the tables file, "" when table views are not persisted (no state directory: Config.Disable, a test binary).
type ConfigExport ¶ added in v0.6.0
type ConfigExport struct {
Dir string `json:"dir"`
Files []string `json:"files"`
Config string `json:"config"`
State string `json:"state"`
}
ConfigExport is what config.export wrote: the directory, the files in it (absolute paths, in the order written) and where the live files are.
type ConfigPaths ¶ added in v0.6.0
type ConfigPaths struct {
Config string `json:"config"`
State string `json:"state"`
Reference string `json:"reference"`
}
ConfigPaths are where the application's user files live: Config is the config directory (bindings.json, settings.json, actions.json, themes.json), State the state directory (history.jsonl, panes.json) and Reference the directory config.export writes to by default. A directory the application has none of is "".
type Context ¶
Context is the derived view of a focus: the instance ids from app down to the focused instance (Path), and the focused input when there is one.
type Ctx ¶
type Ctx struct {
Runtime *Runtime
Context Context
Args Arguments
Instance *Instance
// Subjects are the instances the request acts on: Instance alone,
// or, for a verb that takes many (Operation.Many) run over a visual
// selection, every selected row in display order (Instance among them).
Subjects []*Instance
// Invoked is the name the request ran the verb by: its own key, or an
// alias (an old name, a user's actions.json alias, the other noun of
// an operation reachable under two nouns), with that name's noun as
// the subject side.
Invoked Invocation
}
Ctx is what an application handler receives: the runtime, the context the request runs in, its arguments and the instance it addresses (id, noun, payload).
func (Ctx) ClearNotice ¶ added in v0.4.0
ClearNotice takes back a notice Notify posted.
func (Ctx) Each ¶ added in v0.36.0
func (ctx Ctx) Each(one AppHandler) Result
Each is how a verb that takes many subjects (Operation.Many) makes its change once it knows what to do (an argument given, a chooser answered): one runs for every subject in order, each with a Ctx narrowed to that subject (Instance, Context and Subjects), so the one-subject body stays as it was. A run over several posts the notice a per-row run would (subjectsNotice): one info, or one error counting the done and the failed. A body must answer synchronously (Done or Failed); pending work counts as a failure. On one subject Each is that subject's Result.
func (Ctx) Error ¶ added in v0.31.0
Error sets the status line to an error through the runtime's UI (the TUI's "Error: TEXT" until the next key, an error: line on the CLI); "" clears it. A verb that fails returns Failed instead; Error is for what fails beside the result (a job's Then, a refresh).
func (Ctx) Info ¶ added in v0.31.0
Info sets the status line to a plain message through the runtime's UI (before the hints until the next key, a status: line on the CLI); "" clears it. Notify is the notice that stays.
func (Ctx) Notify ¶ added in v0.4.0
Notify posts a persistent notice through the runtime's UI (the footer in the TUI, a notice: line on the CLI) and returns its id.
func (Ctx) SubjectIDs ¶ added in v0.36.0
SubjectIDs are the ids of ctx's subjects, for a handler that hands them on (Request.Subjects of the request it runs next: a confirm, a chooser's choice).
type DefaultBinding ¶ added in v0.34.0
DefaultBinding is one row of the default layer and where it is declared: a file's source, SourceGo or SourceGenerated.
type Detail ¶ added in v0.2.0
type Detail struct {
// contains filtered or unexported fields
}
Detail is the component a detail instance fronts: a page's read-only detail region (the text beside or below a list about its selected row) that scrolls while the focus stays in the list. The application names the item the detail is about with the func it gives AddDetail (the selected row's id) and draws the text through Window; the framework keeps the offset. A new item starts at the top, checked on every Window and every scroll, so a scroll typed before the next frame lands on the new item; the same item keeps its offset while its text refreshes (clamped to the new length). J and K on the app noun (detail.scroll, counts work: 10J) scroll the current page's detail while it overflows and the focus is on the page outside it; a focused noun that binds J or K (the outline) keeps them, as inner rows answer first. A detail is not a focus stop.
func (*Detail) Marker ¶ added in v0.2.0
Marker is the position marker of the last Window: first and last visible lines and the total, "12–40 / 300", or "" when the text fits.
func (*Detail) Overflows ¶ added in v0.2.0
Overflows reports whether the last Window had more lines than it showed.
func (*Detail) Scroll ¶ added in v0.2.0
Scroll moves the window by lines (down when positive), clamped to the text the last Window measured, and returns the new offset. A new item starts at the top first.
func (*Detail) Width ¶ added in v0.52.0
Width is the widest line of the whole text the last Window measured (wrapped, so at most its width), not only of the lines in view: a panel sized from it keeps one width while the text scrolls.
type EditNode ¶
type EditNode struct {
Text string `json:"text"`
Cursor int `json:"cursor"`
Parent int `json:"parent"`
Children []int `json:"children"`
}
EditNode is one state in an input's undo tree: its text, cursor, parent and children.
type FocusTargeter ¶
type FocusTargeter interface {
FocusTarget() string
}
FocusTargeter is a component that knows where focus lands inside it: a list on its selected row, a grid on its cursor cell.
type Footer ¶
type Footer struct {
// Hints are the binding hints Text ends with (HintCells), so the
// chrome can colour their keys (the hint.key, hint.text and hint.sep
// roles); without them, or when Text does not end with them, the
// whole line draws as one muted label.
// the right end in the cells it reserves, the text cut before them.
Keys *KeyEchoCell
}
Footer is the bottom row of the page chrome: a raw label, styled as an error when Error is set. Jobs are the jobs ticker's entries (Model.JobsTicker), drawn in the rule line above the footer (TickerRule); the body keeps its size, and no jobs means the plain rule.
type ForegroundExit ¶ added in v0.43.0
ForegroundExit is a foreground program's completion value: the program (its base name) and its exit status.
type ForegroundMsg ¶ added in v0.43.0
ForegroundMsg asks the host to give the terminal to Cmd. The Model runs it through tea.ExecProcess (Model.Foreground replaces that, for a story or a test); Runtime.Deliver runs it in place. Done turns the program's exit into the job's completion.
func (ForegroundMsg) Done ¶ added in v0.43.0
func (m ForegroundMsg) Done(err error) tea.Msg
Done is the completion a foreground program's exit (Cmd.Run's error) delivers.
func (ForegroundMsg) Run ¶ added in v0.43.0
func (m ForegroundMsg) Run() tea.Msg
Run runs the program in place on the process's standard streams (those the command leaves nil) and returns its completion: the headless path.
type Guard ¶
Guard is a named condition: an action's availability (Available, the verb guard) or, the older use kept while areas move, a condition a row requires (Binding.When; bindings check lists such rows as debts). The built-in guards are "input" and "no-input" (the focus is or is not an input), "multiline", "count" and "no-count" (the pending count is present or absent), "self" (the focus is the instance whose level the row sits on, not a descendant), "shadow-idle" (the mode a shadow mode such as macro_recording re-dispatches in is normal with an empty payload) and "op:<key>" (the pending operator). Applications add their own with DefineGuard.
type Header ¶
type Header struct {
Title string
Badge string
Focus []string
Subtitle string
Tabs []string
Active int
Segments []SegmentCell
// Keys is the key echo when keys.echo puts it beside the badge.
Keys *KeyEchoCell
// BadgeWidth is the fewest cells the badge's label takes: a shorter
// label is padded inside the badge, so the badge keeps its left edge
// as the mode changes (the shell passes Runtime.ModeBadgeWidth).
BadgeWidth int
}
Header is the top of the page chrome: the title row with an optional right-aligned badge (the shell shows the mode there) and the subtitle row, which is a label or, when Tabs is set, the page tabs with Active marked. The badge is always the right end of the title row. Focus is the focus left of it (the focus-display setting): its levels, outermost first, drawn dim and cut from the left (FitFocusPath) so the innermost level stays. Segments are the status segments (Runtime.SegmentCells), drawn right-aligned in the rule under the header (HeaderRule); they take no row. Every field is a raw label.
type HelpCell ¶ added in v0.15.0
HelpCell is one mode's rows for a key in the help's table view: the first answers, the ones after answer when its guard is false.
type HelpKey ¶ added in v0.15.0
HelpKey is one row of the help's table view: a key (or key class) and its rows per mode, in column order; a mode where nothing answers has no cell.
type HelpRow ¶
type HelpRow struct {
Key string `json:"key"`
Prefix string `json:"prefix,omitempty"`
Final string `json:"final,omitempty"`
Operation string `json:"operation"`
Request string `json:"request,omitempty"`
Hint string `json:"hint,omitempty"`
Args Arguments `json:"args,omitempty"`
Description string `json:"description,omitempty"`
Noun string `json:"noun"`
Section string `json:"section,omitempty"`
// Guard is the guard a hypothetical row (the help's pick and table
// views) answers under; the live help judges guards and leaves it out.
Guard string `json:"when,omitempty"`
// Aliases are the other names of the row's operation (ActionAlias),
// listed once on the row and after its description ("also: …"); the
// row itself always names the canonical operation.
Aliases []string `json:"aliases,omitempty"`
// Enters is the pending mode the row's key enters when the help lists
// that mode's rows after it (the terminal leader: leader_pending).
Enters string `json:"enters,omitempty"`
// Group marks a prefix row: its key starts longer sequences (g of
// g c, the leader ctrl+a), which are listed Under it. A prefix bound
// to nothing alone is a row helpGroups makes, with no Operation.
Group bool `json:"group,omitempty"`
// Under is the prefix row this row is listed under (its longest
// prefix that is a Group row: "ctrl+a" for "ctrl+a v", "g c" for
// "g c x"); "" at the top of its section. Key is the whole sequence.
Under string `json:"under,omitempty"`
// Steps are a sequence's keys one by one, each with what it does at
// that point: entering a mode, waiting for the next key, then the
// final operation. A single key has none.
Steps []HelpStep `json:"steps,omitempty"`
// contains filtered or unexported fields
}
HelpRow is one binding as the help shows it: the key, the operation it runs (noun.verb, or the row's Hint when it has one), arguments resolved when help opens, its description, the answering noun, and the help's section: that noun, or "movement" for a motion (Operation.Motion). Prefix and Final are Key split by SplitKeys (the help's prefix and key columns); Request is the operation the row runs (noun.verb, the noun by its shortest name, also when Operation shows the Hint; "" for a mode transition) and Hint the row's own Hint.
func BindingHelp ¶
BindingHelp lists the rows a focus answers to in its current mode with their descriptions, grouped by the noun of the level that answers, from the innermost instance outward (the focused instance's rows, its noun's, its parents' up to the page, then app; a capture row sits with its own level, so app's ctrl+c comes after the focused row's verbs), and the motions of every level last, under "movement". A row whose key enters a pending mode (the terminal leader) is followed by that mode's rows as whole sequences (helpEnters, R6.10).
func NounHelp ¶ added in v0.15.0
NounHelp is BindingHelp for a hypothetical focus on noun in mode, with no instance (nounRows: the noun's tables, app, the editor fallback for an input noun): a guarded row is listed with its Guard, its operation marked "?", and the rows answering when that guard is false follow it; arguments a row takes from the key, the payload or the row read as "$source".
func PlaceHelp ¶ added in v0.15.0
PlaceHelp is NounHelp with a parent chain: the hypothetical focus on place's noun has the levels the place recorded between it and app (its list, its page; the modal noun inside a modal), each answering with its noun's tables, so a list row's keys from its list and page are there.
type HelpStep ¶ added in v0.29.0
type HelpStep struct {
Key string `json:"key"`
Operation string `json:"operation,omitempty"`
Mode string `json:"mode,omitempty"`
Description string `json:"description"`
}
HelpStep is one key of a sequence as the help's steps show it: the key, and what it does at that point in the sequence: the pending mode it enters (Mode), waiting for the next key, or the final operation.
type HintCell ¶ added in v0.59.0
HintCell is one hint of a hint line: the row's key (or "J/K" for a row whose own hint names its keys) and what it does, "" for a key alone. The chrome draws them in the hint.key and hint.text roles.
type HistoryContext ¶
type HistoryContext struct {
Focus string `json:"focus"`
Page string `json:"page,omitempty"`
Mode string `json:"mode"`
Source string `json:"source"`
}
HistoryContext is the interaction state a request ran in. Source is "key:<keys>", "macro:<register>", "palette", "cli" or "api".
type HistoryEntry ¶
type HistoryEntry struct {
Seq uint64 `json:"seq"`
At time.Time `json:"at"`
Kind string `json:"kind,omitempty"`
Request Request `json:"request"`
Context HistoryContext `json:"context"`
Result HistoryResult `json:"result"`
Moved *HistoryMove `json:"moved,omitempty"`
Job uint64 `json:"job,omitempty"`
// Depth is how many requests enclose this one: a request an operation
// runs while it runs (a choices source, a macro's keys) is one deeper.
Depth int `json:"depth,omitempty"`
// Restored marks an entry read from the history file at start
// (EnsureHistory): an earlier session ran it. Dot-repeat skips it.
Restored bool `json:"restored,omitempty"`
// Changes are what a standard write did to each thing, before and
// after (standard_undo.go): what history.undo reverts.
Changes []ThingChange `json:"changes,omitempty"`
}
HistoryEntry is one user action: what ran, where, from which source, how it ended and, when it moved the interaction, from where to where (Moved). It holds ids and the request, never the data the operation returned, so an entry costs the same over a list of ten rows or ten thousand. Kind is the operation's HistoryKind. Job is the job id an application verb launched.
type HistoryMove ¶ added in v0.7.0
type HistoryMove struct {
From HistoryPlace `json:"from"`
To HistoryPlace `json:"to"`
}
HistoryMove is how a request moved the interaction: j on a list moves the focus from row A to row B, page.next from one page to the next, a modal's open into the modal and its close back out.
type HistoryPlace ¶ added in v0.7.0
type HistoryPlace struct {
Focus string `json:"focus"`
Page string `json:"page,omitempty"`
Mode string `json:"mode"`
}
HistoryPlace is where the interaction stands: the focused instance (a list's focus is its selected row), the page and the mode.
type HistoryResult ¶
HistoryResult is the outcome: ok, or the error. The value the operation returned is the caller's (the CLI prints it), not the history's; a reference to it (a hash into a content-addressed store) would go here, beside ok.
type Input ¶
type Input struct {
ID string
Text []rune
Cursor int
Mode string // the editing mode: normal, insert or a visual mode; pending modes live on the instance
Multiline bool
Kind string
PathFilter string
// Secret marks an input whose text is never shown outside it: the key
// echo (keys.echo) shows nothing at all while it has the focus, not
// even how much was typed. A record editor field over a Secret prop
// sets it (RecordField.Secret).
Secret bool
// Completions are the input's completion triggers (Completions, the
// AddInput option); none falls back to its noun's.
Completions []CompletionTrigger
// ReadOnly makes the input a viewer: the cursor, motions, visual
// selections and yanks work, every edit is a silent no-op (Replace
// leaves the text, insert mode is not entered, a delete or change
// operator neither deletes nor yanks), and the editing verbs are
// unavailable at it (guard input-writable), so their rows stand aside
// and leave the hints. Like Vim's 'nomodifiable', without E21: nothing
// is reported. Set it before or after AddInput (or the ReadOnly option).
ReadOnly bool
Anchor int
History []EditNode
Head int
// contains filtered or unexported fields
}
Input is a single- or multi-line modal text field with an undo tree.
func (*Input) Count ¶
Count is the pending Vim count, read from the global mode payload while the input is focused.
func (*Input) Pending ¶
Pending describes the pending editor mode the way the old grammar did: "d" for an operator, "g" for a g prefix, "dg" for both, "register" while a register name is awaited, "" otherwise.
func (*Input) SelectAll ¶ added in v0.38.0
SelectAll opens a select range over the whole text (SelectText).
func (*Input) SelectText ¶ added in v0.38.0
SelectText opens a select range over the runes [start, end) in insert mode, as Vim's select mode does over a new name: the first text typed (input.insert, a paste) replaces the range and typing continues in insert; backspace or delete removes it; a motion, a mode change (esc), an undo or any other edit closes it and keeps the text. The range is drawn in the visual-selection style. It is a state of the input, not a mode: the person is inserting, and the mode stays insert. An empty range selects nothing and only enters insert at end.
func (*Input) SelectedText ¶ added in v0.38.0
SelectedText is the open select range (SelectText), if any.
func (*Input) Selection ¶ added in v0.43.0
Selection is the visual selection's rune range [start, end) while the input is in a character or line visual mode (v, V): the runes under the anchor and the cursor are both in it, a line selection covers whole lines and its last newline. ok is false outside a visual mode and in a block selection (visual-block), which is not one range (its snapshot names the rows and columns). Hosts read it instead of recomputing it from Anchor and Cursor.
func (*Input) SetMode ¶
SetMode is the mode-transition hook for both editor operations and set.mode. Direct assignment to Mode cannot delimit insert sessions.
func (*Input) SetText ¶ added in v0.56.0
SetText puts text in the input from the program, read-only or not: a viewer refreshed with what it shows (a jq panel following the query). The text becomes the undo tree's root (nothing to undo back to); the cursor and a visual selection's anchor keep their offsets, clamped into the new text as a motion would leave them (in normal mode not past the line's last character); an open select range and an insert session end. A single-line input keeps the text up to its first line break. The same text again changes nothing, so the undo history stays.
type Instance ¶
type Instance struct {
ID string `json:"id"`
Noun string `json:"noun"`
Parent string `json:"parent,omitempty"`
Payload Payload `json:"payload"`
Bindings []Binding `json:"bindings,omitempty"`
Unfocusable bool `json:"unfocusable,omitempty"`
Label string `json:"label,omitempty"` // a display name (a list row's label, a header name); {{label}} in a confirm prompt
Data any `json:"data,omitempty"` // an opaque application value (a list row's ListItem.Data)
Component any `json:"-"`
// contains filtered or unexported fields
}
Instance is one addressable thing on screen: a page, a list, a list row, a modal body, or an input. Parent links form the focus stack; walking them from the focused instance outward is the path Context.Path spells out. An instance holds no mode: the mode is global (Runtime.Mode). Payload is the data a modal body carries (a confirm's prompt and request). Bindings are this instance's own rows, resolved above its noun's table at the same stack level. Component holds the typed component the instance fronts. Unfocusable opts the instance out of being a focus stop although its noun is Focusable (a disabled panel). Label is an optional display name a confirm prompt reads as {{label}}. Data is an opaque application value (a list row's ListItem.Data); the framework never reads it.
type InstanceOption ¶
type InstanceOption func(*instanceSpec)
InstanceOption configures the instance constructors: Instance, AddPage, AddList, AddInput, AddTerminal and RegisterPage.
func CellSelect ¶ added in v0.13.0
func CellSelect() InstanceOption
CellSelect makes a table (AddList with Columns) cell-based: a current column beside the selected row, moved with h/l, 0/$, N| and g c, and the cell keys y and z >/z </z =. For a table one reads cell by cell (a JSON or CSV view). AddTree ignores it: a tree's rows answer h and l.
func ClearFilterOnEnter ¶ added in v0.10.0
func ClearFilterOnEnter() InstanceOption
ClearFilterOnEnter makes enter in a list's (or a tree's list's) filter line choose the selected match: list.filter-choose clears the filter with the selection staying on that row, every row shows again, the mode is normal and the page keeps the row on screen. For a list one picks a row from, such as a pane list. With no match enter keeps the filter, as on every other list (list.filter-keep; its verb guard, list-chooses, is false there and off this option).
func CloseOnDetach ¶
func CloseOnDetach() InstanceOption
CloseOnDetach makes terminal.detach remove the terminal instance after returning focus, so the stream is released (see TerminalReleaser) instead of kept for a later attach. Only AddTerminal reads it.
func Columns ¶
func Columns(cols ...Column) InstanceOption
Columns makes AddList's list a table with these columns (List.SetColumns changes them later). A list without columns draws its labels.
func Completions ¶ added in v0.5.0
func Completions(triggers ...CompletionTrigger) InstanceOption
Completions gives an input its completion triggers (AddInput reads it). They replace the triggers its noun declares (NounBuilder.Completions).
func DefaultHidden ¶ added in v0.41.0
func DefaultHidden() InstanceOption
DefaultHidden declares a page hidden by default (Page.DefaultHidden): it starts out of the tabs until page.show (or the pages.hidden setting) brings it in. AddPage and RegisterPage read it; other constructors ignore it.
func Focus ¶
func Focus(id string) InstanceOption
Focus names the instance a page starts focused on (default: the page itself). Other constructors ignore it.
func FocusOnClose ¶
func FocusOnClose(id string) InstanceOption
FocusOnClose names the instance the focus moves to when this instance is removed while the focus is on it or inside it: a CloseOnDetach detach, Pop of a modal body, a list row dropped by SetItems, RemoveInstance. A target that is gone (or removed with it) falls back to the default (the parent, or the return Pop restores). Every constructor reads it.
func FollowTail ¶ added in v0.17.0
func FollowTail() InstanceOption
FollowTail makes a timeline follow its end: the window sticks to the bottom while the last card is selected and the bottom is in view; a card appended then is selected and a growing last card keeps its bottom in view. Moving or scrolling up stops it; G or reaching the bottom again resumes it.
func HeaderLines ¶ added in v0.17.0
func HeaderLines(n int) InstanceOption
HeaderLines caps a closed card's header at n lines, the rest read "… N more lines"; an open card shows its whole header. 0 shows every line.
func Kind ¶
func Kind(noun string) InstanceOption
Kind names the noun the instance answers to (default: the instance id for plain instances, "editor" for inputs, "list" for lists, "page" for pages, "terminal" for terminals).
func NoMarks ¶ added in v0.2.0
func NoMarks() InstanceOption
NoMarks makes a list (or a tree's list) a read-only view: its rows take no marks, so space does not answer with list.mark there (the verb's guard, list-marks, is false; the footer and ? help leave it out) and list.mark refuses. list.apply still runs on the selected row.
func NoSpill ¶
func NoSpill() InstanceOption
NoSpill makes a list trap its motions: list.move past its last (first) row stays on that row instead of moving the focus to the next (previous) stop on the page. For a list that must keep the focus, such as a picker.
func Parent ¶
func Parent(id string) InstanceOption
Parent places the instance under another instance (default app).
func ParentStop ¶ added in v0.30.0
func ParentStop(id string) InstanceOption
ParentStop names where h on a closed card of the timeline goes (an instance; a stop lands on its remembered or selected child). Without it h on a closed card stays.
func ReadOnly ¶ added in v0.55.0
func ReadOnly() InstanceOption
ReadOnly makes AddInput's input read-only (Input.ReadOnly).
func RowSelect
deprecated
added in
v0.12.0
func RowSelect() InstanceOption
RowSelect is a no-op kept for code written against v0.12.0, where every table was cell-based unless added with it.
Deprecated: tables select rows unless added with CellSelect; drop it.
func SpillToSelection ¶ added in v0.55.0
func SpillToSelection() InstanceOption
SpillToSelection makes a spill into a list (j or k past the edge of the stop beside it, R3.4) land on the list's selected row instead of its first or last: for a list that chooses what is drawn beside it (the Settings page's section list), so moving back into it keeps the choice.
type Invocation ¶ added in v0.28.0
type Invocation struct {
Name string `json:"name"`
Noun string `json:"noun"`
Verb string `json:"verb"`
Alias bool `json:"alias,omitempty"`
}
Invocation is the name a request ran an action by: the action's own key or one of its aliases. Noun is that name's noun (the subject side: for project.associate, an alias of pane.associate, it is project), Verb its verb. Handlers read it from Ctx.Invoked (application verbs) or Runtime.Invoked (interaction handlers).
type JobInfo ¶
type JobInfo struct {
Job uint64 `json:"job"`
Owner string `json:"owner"`
Verb string `json:"verb"`
Label string `json:"label,omitempty"`
Slot string `json:"slot,omitempty"`
Scope string `json:"scope,omitempty"`
Started time.Time `json:"started"`
State string `json:"state"`
Error string `json:"error,omitempty"`
}
JobInfo is one row of the jobs list: what jobs.list returns and what the snapshot's /jobs holds for running jobs.
type JobLingerMsg ¶
JobLingerMsg is the ticker's one-shot timer: it fires when the oldest remembered finished job passes JobLinger, so the frame it causes drops the row with no key pressed. At is the deadline it was scheduled for; only the message for the timer in flight clears it.
type KeyEchoCell ¶ added in v0.55.0
KeyEchoCell is the key echo as the shell draws it (Header.Keys, Footer.Keys): the entries, oldest first, and the cells it reserves (keys.echo-width), which the shell holds to at most half the line.
type KeyEvent ¶
type KeyEvent struct {
Key MacroKey
Mode ModeState
Focus string
Level string // the instance whose level is answering, "" for a noun-only level
// Args are the arguments of the request whose availability is judged
// (Available): a row's own, or a call's; nil for a row's own guard.
Args Arguments
}
KeyEvent is what a row receives: the key, the mode it was resolved in and the focused instance.
type KeyOutcome ¶ added in v0.36.0
type KeyOutcome int
KeyOutcome is what resolving one key came to (DispatchOutcome).
const ( // KeyUnhandled: no level had a row on the key whose action is // available, so it went past app. KeyUnhandled KeyOutcome = iota // KeyHandled: a row ran, or the key started or continued a sequence. KeyHandled // KeyConsumed: the row that answered runs the noop (NoopAction), the // always-available action a clamping container binds a key to so it // goes no further out: handled, and nothing happened. KeyConsumed )
type Layout ¶
type Layout struct {
Width, Height int
Styles Styles
// Shift moves the divider of every split this layout draws, in percent
// points of the split's length: positive grows the first (left or top)
// panel, negative the second, 0 is the split's default. It is the
// page's remembered divider (Runtime.PaneLayout sets it; pane.grow,
// pane.shrink and pane.reset change it). Divide applies it.
Shift int
// contains filtered or unexported fields
}
Layout renders page chrome, bounded panels and panel pairs for a viewport. It is a plain value: every method only renders and keeps no state.
Example ¶
layout := Layout{
Width: 80, Height: 24,
Styles: NewStyles(Appearance{Theme: "adaptive"}),
}
body := layout.Split("Files", "main.go\nlayout.go", "Preview", "Selected file contents")
page := layout.Page("Workspace", "Browse files", body, "Enter open · Esc back")
fmt.Print(page)
func (Layout) BodySize ¶
BodySize returns the exact cells available to Page's body. Viewports that cannot hold any body report 0, 0. Small viewports drop the header and keep only a footer row.
func (Layout) BodySizeWith ¶
BodySizeWith is the body's size with the footer f: BodySize, since the jobs ticker rides the rule line above the footer and takes no body row, so a job starting or lingering out never moves or hides the body (UX review 2 F13).
func (Layout) Divide ¶ added in v0.4.0
Divide is where a split of total cells puts its divider: first is the split's default size of its first (left or top) panel, moved by Shift percent points of total and clamped so each panel keeps least cells. A split with no shift, or too small for two panels of least cells, keeps first. A layout of its own (a page body split by hand) calls it with its default; Split and its kin call it for theirs.
func (Layout) HeaderRule ¶ added in v0.36.0
func (l Layout) HeaderRule(cells []SegmentCell, width int) string
HeaderRule is the rule line under the header, width cells: the plain rule with no segments; with segments, rule characters, then the segments right-aligned, joined by " · ", then " ──". Segments are dropped from the last while they do not fit, and when the first alone does not, it is cut with "…"; at least "── " of rule stays on the left. Each segment draws in its tone (muted without one), the rule and separators muted, so the chrome still reads as a rule.
func (Layout) Page ¶
Page renders title, subtitle, body and footer into exactly Width x Height cells. Body is trusted ANSI; title, subtitle and footer are raw labels. Overlong bodies are clipped; use Panel for a visible overflow marker.
func (Layout) PageBlock ¶
PageBlock is Page for a body that may carry a cursor; the cursor is moved by the page chrome around the body.
func (Layout) Panel ¶
Panel renders a rounded, titled box of exactly width x height outer cells. Focused panels use the heavy accent border. Body is trusted ANSI; title is a raw label. Content that does not fit is clipped and marked with "…" (columns) or a "… N more" last row (lines). Below 3x3 cells the border is dropped.
func (Layout) PanelBlock ¶
PanelBlock is Panel for a body that may carry a cursor; the cursor is moved inside the border and padding.
func (Layout) Shell ¶
Shell is the one page chrome: title row, subtitle row, a rule, the body, a rule, the footer and a bottom margin, inside a gutter, into exactly Width x Height cells. Viewports too small for the chrome keep the body and, from three rows up, the footer. The shell and PageBlock both render through it, so a page and the application around it reserve the same rows. The body's cursor is moved by the chrome around it.
func (Layout) Sidebar ¶
func (l Layout) Sidebar(title string, items []string, selected int, mainTitle, mainBody string) string
Sidebar renders a 28-cell navigation rail beside the main panel. Below 72 columns it stacks above the main panel. Items are raw labels; mainBody is trusted ANSI. Selection is zero-based and clamped for rendering. The caller owns selection and key handling; this method keeps the selected item visible.
Example ¶
layout := Layout{Width: 80, Height: 24, Styles: NewStyles(Appearance{Theme: "adaptive"})}
body := layout.Sidebar("Workspace", []string{"Files", "Search", "Settings"}, 1, "Search", "Search results")
fmt.Print(layout.Page("Project", "Workspace navigation", body, "↑↓ select · Enter open"))
func (Layout) SidebarBlock ¶
func (l Layout) SidebarBlock(title string, items []string, selected int, mainTitle string, mainBody Block) Block
SidebarBlock is Sidebar for a main body that may carry a cursor.
func (Layout) Split ¶
Split renders two panels filling BodySize: side by side (left ~40%) when the viewport is at least 72 cells wide, otherwise stacked (top ~40%), the divider moved by Shift (Divide). The left or top panel is the focused one; SplitFocusBlock takes which.
func (Layout) SplitBlock ¶
func (l Layout) SplitBlock(leftTitle string, leftBody Block, rightTitle string, rightBody Block) Block
SplitBlock is Split for bodies that may carry a cursor. One body should carry it; when both do, the left or top panel wins.
func (Layout) SplitFocusBlock ¶ added in v0.2.0
func (l Layout) SplitFocusBlock(focused SplitSide, leftTitle string, leftBody Block, rightTitle string, rightBody Block) Block
SplitFocusBlock is SplitBlock with the focused panel named: the one holding the focus draws in the focused style (accent title and border), the other plain, so a view whose focus moves between its panes (o-json's tree and detail) shows where it is. When both bodies carry a cursor, the focused panel's wins.
func (Layout) TickerRule ¶ added in v0.2.0
TickerRule is the rule line above the footer, width cells: the plain rule with no jobs; with jobs, "── " then the ticker entries (Footer.Jobs, at most JobTickerRows) joined by " · ", cut with "…" so at least " ─" of rule is left, and the rest of the row filled with rule characters, all muted, so the chrome still reads as a rule.
func (Layout) WithPanelTone ¶ added in v0.59.0
WithPanelTone is the layout whose panels (Panel, PanelBlock) carry tone, a tone name such as state.working, on their border, as a timeline card carries Card.Tone: the border draws in the chrome row border.<tone> of the chrome.color level (chrome.rich.border.state.working), bold when the panel is focused, and keeps its heavy lines when focused. A level with no such row, or "", draws the panel's usual border. An application passes the state of the thing a panel shows (a terminal pane's agent state):
layout.WithPanelTone(stateTone(pane)).PanelBlock(title, body, w, h, focused)
type LineScroller ¶ added in v0.50.0
type LineScroller interface {
// CanScrollLines reports whether the last frame windowed the lines (more
// lines than the window shows), so a scroll would move it.
CanScrollLines() bool
// ScrollLines moves the window by lines, down when positive, clamped to
// the first and last line.
ScrollLines(lines int)
}
LineScroller is a component that windows its own lines and scrolls that window without a motion of the cursor (Vim's ctrl+e and ctrl+y, :help CTRL-E): the window moves, and the cursor stays where it is unless it would leave the window (with the page's scrolloff), when it moves to the nearest line still shown. A list (tables and trees through their list), a timeline and a markdown document implement it; view.scroll scrolls the innermost one on the focus path that can.
type Lines ¶
type Lines []any
Lines is a result printed as JSON Lines (one compact value per line, no outer array) by a CLI, so a reader can decode it as it arrives; over JSON it is an array. HandleCall keeps the type through its copy.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List owns flat selection, marks and scrolling on the runtime's event loop. Focus sits on the selected row when there is one, else on the list.
func (*List) CanScrollLines ¶ added in v0.50.0
CanScrollLines reports whether the list windowed its rows in the last frame (more rows than its window).
func (*List) Column ¶ added in v0.12.0
Column is a cell-mode table's current column (an index into Columns); 0 for any other list.
func (*List) ColumnOffset ¶ added in v0.9.0
ColumnOffset is the table's column offset: 0 unscrolled, else k for the view that starts the scrolling columns at the k-th.
func (*List) ColumnWidths ¶ added in v0.12.0
ColumnWidths is the widths given to columns with z > and z < (column index to cells); a column left out is laid out automatically.
func (*List) EndVisual ¶ added in v0.12.0
func (l *List) EndVisual()
EndVisual ends a visual selection: the marks go back to the ones it started over.
func (*List) Filter ¶ added in v0.8.0
Filter is the list's filter query ("" when every row is shown).
func (*List) Filtering ¶ added in v0.8.0
Filtering reports whether the filter line shows: a filter is set, or its query is being typed on this list.
func (*List) FocusTarget ¶
FocusTarget is where a focus jump to the list lands: its selected row.
func (*List) Focused ¶
Focused derives focus from the active frame instead of retaining a stale flag.
func (*List) Height ¶ added in v0.8.0
Height is the lines the list needs to draw every row without windowing (a table's header aside): Len, plus the filter line while it shows. A host that sizes a list to its rows sizes it with Height, so opening the filter line neither windows the rows nor moves what is drawn below the list as the filter narrows it.
func (*List) Items ¶
Items returns a copy of every row in display order, the ones a filter hides included. Cells and Tones are copies too, so editing a returned row in place changes nothing until SetItems, which re-measures it; Data is the application's value, shared as given.
func (*List) Len ¶
Len is the number of rows, the ones a filter hides included (Shown counts the rest).
func (*List) Marked ¶
Marked lists the marked rows in list order, the ones a filter hides included (a mark survives the filter).
func (*List) MatchMode ¶ added in v0.59.0
MatchMode is the filter's match mode: the one search.cycle-match or search.set-match chose for this list, else the search.match setting.
func (*List) ModeChanged ¶ added in v0.43.0
ModeChanged follows the global mode (ModeObserver): a line-shaped selection mode entered with the focus on one of the list's rows starts the selection there; leaving it with the focus on the list ends it. A mode left for a modal opened over the selection holds it: the mode the modal restores on close resumes it, anchor and marks as they were.
func (*List) Patch ¶ added in v0.8.0
Patch applies a record-level change (ListPatch) without the caller rebuilding the rows: it is SetItems over the patched rows, so a row that stays keeps its instance (and the bindings and pending jobs on it), the selection and the marks follow their ids, and only a removed row's instance is closed. An empty patch does nothing; an invalid one (an index out of order or out of range, a repeated id) leaves the list unchanged. The patch applies to every row, the ones a filter hides included, and SetItems filters the result again.
func (*List) PinnedColumns ¶ added in v0.25.0
PinnedColumns is the table's pinned columns (indexes into Columns) in declared order.
func (*List) ResetColumnWidths ¶ added in v0.12.0
func (l *List) ResetColumnWidths()
ResetColumnWidths makes every column automatic again and remembers it.
func (*List) ResetPins ¶ added in v0.25.0
func (l *List) ResetPins()
ResetPins puts the default pins back (Column.Pinned, else the first).
func (*List) ScrollLines ¶ added in v0.50.0
ScrollLines moves the list's window by lines rows, clamped, keeping the selection unless it would leave the window's scrolloff margin; then it moves to the nearest row inside (relaxed at the first and last row, as windowOffset is). It never spills.
func (*List) Select ¶
Select changes the selected row by stable ID without taking focus. A row the filter hides is shown by clearing the filter.
func (*List) SetColumn ¶ added in v0.12.0
SetColumn makes column i (clamped) the current column of a cell-mode table and remembers it; on any other list it does nothing.
func (*List) SetColumnWidth ¶ added in v0.12.0
SetColumnWidth fixes column i at width cells (0 or less: automatic again) and remembers it.
func (*List) SetColumns ¶
SetColumns replaces the list's columns; none makes it a plain list again.
func (*List) SetFilter ¶ added in v0.8.0
SetFilter sets the filter query and shows the rows that match it; "" shows every row. The selection stays on its row when that row still shows, else it moves to the first match (none when nothing matches); the focus follows it.
func (*List) SetItems ¶
SetItems copies rows, preserves selection by ID, and falls back to the nearest remaining index if that ID disappears. Invalid updates leave the list unchanged. A filter (SetFilter) stays and applies to the new rows. It creates one instance per new row under the list and removes the instances of rows that disappear; a retained row keeps its instance and any bindings the application put on it. Rows whose cells are unchanged keep a table's measured widths. A record-level change is Patch.
func (*List) SetPinnedColumns ¶ added in v0.25.0
SetPinnedColumns makes these columns (indexes into Columns) the table's pins and remembers them; the default pins are remembered as no choice.
func (*List) Shown ¶ added in v0.8.0
Shown is the number of rows the filter lets through (Len without one).
func (*List) Snapshot ¶
Snapshot is the list's state with a copy of its rows (the snapshot's /lists entry); changing it never reaches the list.
func (*List) StartVisual ¶ added in v0.12.0
StartVisual starts a visual row selection at the selected row; a list without rows or one added with NoMarks refuses.
func (*List) ToggleMark ¶
ToggleMark marks or unmarks a row for fan-out verbs; a list added with NoMarks refuses.
func (*List) UnpinColumn ¶ added in v0.25.0
UnpinColumn unpins column i.
func (*List) UnpinColumns ¶ added in v0.25.0
func (l *List) UnpinColumns()
UnpinColumns leaves no column pinned.
func (*List) View ¶
View fits the viewport and updates its scroll offset to keep selection visible; a list with columns draws as a table (tableView). Calling it places the list in its page's drawing order (Placed), even at zero height, and reports its selected row's line (PlacedAt) so the page scrolls to keep that row on screen.
type ListItem ¶
type ListItem struct {
ID string `json:"id"`
Label string `json:"label"`
Noun string `json:"noun"`
Data any `json:"data,omitempty"`
Cells []string `json:"cells,omitempty"`
Section string `json:"section,omitempty"`
Tones []ToneSpan `json:"tones,omitempty"`
}
ListItem is application-owned identity, display text, and the registered noun the row answers to. Each row is an Instance whose ID is the item ID and whose Parent is the list; its bindings and actions come from its noun. Data is an opaque value the application keeps on the row (a host's record of the row, an extension's own id); SetItems copies it to the row instance's Data, where a verb reads it as Ctx.Instance.Data. The framework never reads it. Cells are the row's text per column when the list has columns (a table, Columns); Label stays the row's name for the palette, search and {{label}}, and is the first cell of a row without cells. Section groups a table's rows: List.View draws the section as a label line above the first row of each run of rows with the same Section (a list without columns ignores it). Tones give cells, or runs inside them, a named tone the theme colours (ToneSpan, tone.go; in a list without columns cell 0 is the label); they never change the text.
type ListPatch ¶ added in v0.8.0
ListPatch is a record-level change to a list's rows: the rows that changed or were added, whole (Upsert), and the ids of the rows that went away (Remove). Every other row stays as it is, in its order.
At, when given, is each upserted row's index in the patched list, one per Upsert and ascending: the rows neither upserted nor removed keep their relative order and fill the indexes the upserts leave free. Without At a row whose id the list has replaces it in place and a new row is appended, in Upsert order.
type ListQuery ¶ added in v0.52.0
ListQuery is what list hands its store: the where pairs (prop to typed value, equality, all of them), the limit (0 for none) and the store's own ListParams the request gave. A store may use them to read less; the runtime applies where and limit to the answer either way, so a store that ignores them is still right.
type MacroState ¶
type MacroState struct {
Recording string `json:"recording,omitempty"`
Last string `json:"last,omitempty"`
Keys []MacroKey `json:"keys,omitempty"`
Depth int `json:"depth"`
Steps int `json:"steps"`
}
MacroState is the application-wide recording and replay state. Awaiting a register name is the macro_pending or replay_pending mode of the focused instance, not a field here.
type Matcher ¶ added in v0.59.0
type Matcher struct {
// contains filtered or unexported fields
}
Matcher is one query compiled in one match mode, case as search.case says. Build it with NewMatcher or Runtime.Matcher; the zero value matches everything as a substring search.
func NewMatcher ¶ added in v0.59.0
NewMatcher compiles query in mode (substring for an unknown mode) with case as the search.case value caseMode gives it. A blank query matches every text. For regex, smart case folds unless the pattern holds an upper-case letter outside an escape (\S, \W and \p{Lu} do not count, as in Vim), and folding is the (?i) flag.
func (Matcher) Err ¶ added in v0.59.0
Err is why the query matches nothing (an invalid regex), else nil.
func (Matcher) Fold ¶ added in v0.59.0
Fold reports whether Prepare folds case (a regex folds through (?i) instead, so its texts are prepared unchanged).
func (Matcher) MatchPrepared ¶ added in v0.59.0
MatchPrepared reports whether hay, a text from Prepare, matches.
func (Matcher) Prepare ¶ added in v0.59.0
Prepare is text as the matcher compares it; a caller that matches the same texts often can keep the prepared texts while Fold is unchanged.
func (Matcher) Scattered ¶ added in v0.59.0
Scattered reports whether the mode's matches may be strewn across the text (fuzzy), rather than spelled in it.
func (Matcher) ScorePrepared ¶ added in v0.59.0
ScorePrepared reports whether hay (from Prepare) matches and how well: fuzzyScore for fuzzy (compact runs and word starts score higher), the sum of each word's fuzzyScore for substring, 0 for regex. Higher is better; the blank query scores 0 everywhere.
type ModalBody ¶ added in v0.2.0
ModalBody is a modal body component that draws itself: a modal whose instance's Component implements it needs no ModalView (a record editor opened as a modal, its chooser, a Chooser). A ModalView for the id still wins.
type ModalOption ¶
type ModalOption func(*modalSpec)
ModalOption configures OpenModal.
func ReplaceOpen ¶ added in v0.52.0
func ReplaceOpen() ModalOption
ReplaceOpen makes an open of a kind that is already the top modal close that modal first and open the new one in its place, over the focus and mode the old one opened over: a viewer asked to show something else (docs.open TOPIC inside the docs viewer) shows it instead of failing "already open" or stacking a second copy. Without it a second open of an open kind is refused, so a modal holding a question (a confirm, a prompt, a chooser) keeps it. A kind open beneath another modal is still refused.
func WithInput ¶
func WithInput(in *Input, opts ...InstanceOption) ModalOption
WithInput places an input inside the modal body and focuses it, so a one-field prompt is one call. The input is registered under the body (a Kind option names its noun; Parent is ignored) and is removed with the body on Pop; the *Input keeps its text and undo history and may be passed again to the next OpenModal.
type ModalView ¶
ModalView renders one modal without replacing or inspecting its parent page. Render receives the modal instance (its Payload carries what OpenModal gave it) and returns the body as a Block; its cursor, when the modal holds the focused input, is relative to the body's top-left cell.
type ModeBuilder ¶
type ModeBuilder struct {
*NounBuilder
// contains filtered or unexported fields
}
ModeBuilder binds rows into one mode table of a noun.
func (*ModeBuilder) Bind ¶
func (m *ModeBuilder) Bind(keys string, row Binding) *ModeBuilder
Bind adds an exact-key (or key-sequence) row, replacing the row with the same keys and guard (Binding.Guard, or When after Bind).
func (*ModeBuilder) Extends ¶
func (m *ModeBuilder) Extends(parent string) *ModeBuilder
Extends makes the selected mode's table read parent's rows after its own, as the editor spec's "extends" does: three motion tables become one table and two that extend it. A mode extends one parent; Extends("") removes the link.
func (*ModeBuilder) Pattern ¶
func (m *ModeBuilder) Pattern(pattern string, row Binding) *ModeBuilder
Pattern adds a key-class row.
func (*ModeBuilder) Unbind ¶
func (m *ModeBuilder) Unbind(keysOrPattern string) *ModeBuilder
Unbind removes the unguarded row with these keys or this pattern; a guarded row on them stays (UnbindGuarded removes that one).
func (*ModeBuilder) UnbindGuarded ¶ added in v0.6.0
func (m *ModeBuilder) UnbindGuarded(keysOrPattern, guard string) *ModeBuilder
UnbindGuarded removes the row with these keys or this pattern and this guard ("" is the unguarded row).
func (*ModeBuilder) When ¶
func (m *ModeBuilder) When(guard string) *ModeBuilder
When guards the last bound row with a registered guard name. The guard is part of the row's identity, so the row is placed again under it: a row it replaced as an unguarded row comes back, and it replaces the row with the same keys and this guard instead.
type ModeObserver ¶
type ModeObserver interface {
ModeChanged(from, to string)
}
ModeObserver is implemented by a component that follows the base mode while the focus sits on it or beneath it: the grid starts and ends its selection when a visual shape is entered or left.
type ModeOption ¶ added in v0.43.0
type ModeOption func(*ModeSpec)
ModeOption is a property DefineMode gives a mode, as a bindings file's "modes" entry does.
func ModeExtends ¶ added in v0.43.0
func ModeExtends(parent string) ModeOption
ModeExtends makes a mode fall back to parent's rows for every noun with no table of its own in the mode (no rows and no extends there): a mode that is "normal plus a few keys" (o-json's query, visual-line) binds only its own keys, and the nouns it does not mention keep their normal rows. A noun's own table (even an empty one, or one with its own extends) replaces the fallback for that noun.
type ModeSpec ¶ added in v0.33.0
type ModeSpec struct {
Pending bool `json:"pending,omitempty"`
Passthrough bool `json:"passthrough,omitempty"`
// Selection is the selection shape the mode holds (char, line, block;
// DefineSelection), "" for a mode that selects nothing.
Selection string `json:"selection,omitempty"`
// Extends is the mode whose rows the mode falls back to for a noun
// with no table of its own in it (ModeExtends).
Extends string `json:"extends,omitempty"`
}
ModeSpec is one mode's entry in a bindings file's "modes".
type Model ¶
type Model struct {
// Foreground answers a ForegroundMsg (a verb's Foreground program);
// nil runs it through tea.ExecProcess, suspending the TUI. o-story
// and tests replace it to run the program headless.
Foreground func(ForegroundMsg) tea.Cmd
Runtime *Runtime
Palette *Palette
Appearance *Appearance
ModalViews map[string]ModalView
Title string
Width int
Height int
// Status is the status line in its error tone: the last key's error,
// or what a handler set with ctx.Error (ctx.Status); the footer reads
// "Error: TEXT" in the error style in place of the hints. Info is the
// line in its neutral tone (ctx.Info), drawn plain before the hints.
// Setting one clears the other, and the next key clears both.
Status string
Info string
// Notices are persistent lines (a host's mount warnings), kept across
// keys and errors until notice.clear (or the application) clears them.
// The footer shows the newest before the hints, cut to half the width,
// with "(+N more)" for the rest (notice.list has them all), so notices
// never hide the hints. A notice does not go with the next key. The
// Model is the runtime's UI sink (Runtime.UI), so ctx.Notify,
// ctx.Error and ctx.Info land here.
Notices []string
// Sidebar replaces page tabs with a navigation rail. Existing page operations
// remain the only navigation state; input focus and modal routing are unchanged.
Sidebar bool
// Now is the Model's clock: the ticker's memory of finished jobs and
// the linger timer read it (time.Now by default, time.Now when nil). A
// headless host fakes it, advances it to JobLingerTick's deadline and
// delivers that message instead of waiting JobLinger.
Now func() time.Time
// contains filtered or unexported fields
}
Model is the Bubble Tea adapter. Pages and modal instances retain their state in Runtime; components (picker, registers, application components) are instances the runtime drives through the delivery contract, so the adapter holds no component list of its own.
func (*Model) Init ¶
Init installs the user actions file (Runtime.EnsureUserActions) and applies the user bindings file (Runtime.EnsureUserBindings), after the application defined its own nouns and rows, declares the framework's settings (EnsureConfigSettings), reads settings.json (its problems are notices), draws themes.json's schemes and the theme setting's (applyThemeSetting), restores and persists the action history (EnsureHistory), leaves a start page the pages.hidden setting hides for the first page in the tabs (OpenVisibleStart), starts the settings.json poll (SettingsPoll) when the application declared settings, and asks for the background colour.
func (*Model) JobLingerTick ¶
func (m *Model) JobLingerTick() (JobLingerMsg, bool)
JobLingerTick is the linger timer in flight, the message its tea.Tick will deliver at its deadline (At), and false when none is scheduled. A host with a fake Now advances the clock to At and delivers the message itself rather than waiting JobLinger.
It is the Model's one linger timer: the key echo's entries (keys.echo- linger) ride it too, so the earlier of the two deadlines in flight is the one returned, and its message clears whichever timer it was for.
func (*Model) JobsTicker ¶
JobsTicker is the ticker the shell draws in the rule line above the footer for the current frame, as plain entries at most width cells each: none when no job shows.
func (*Model) KeyEchoLabels ¶ added in v0.55.0
KeyEchoLabels are the entries the key echo shows now, oldest first: none while keys.echo is off.
func (*Model) Notify ¶
Notify adds a persistent notice to the footer (Notices) through the runtime's UI, as ctx.Notify does, and returns its id; notice.clear removes them.
func (*Model) SegmentTick ¶ added in v0.36.0
func (m *Model) SegmentTick() (SegmentTickMsg, bool)
SegmentTick is the segment timer in flight, the message its tea.Tick will deliver at its deadline (At), and false when none is scheduled. A host with a fake Now advances the clock to At and delivers the message itself rather than waiting.
func (*Model) SegmentsInFlight ¶ added in v0.36.0
SegmentsInFlight counts the refreshes started and not yet answered.
func (*Model) StatusSegments ¶ added in v0.36.0
StatusSegments are the segment texts the header rule draws this frame, first to last, before fitting (Layout.HeaderRule cuts what does not fit).
func (*Model) Styles ¶ added in v0.10.0
Styles is the Model's appearance with the dim settings applied (modal-dim, dim-unfocused, modal-highlights) and the chrome level (chrome.color) in the current mode; the shell, modals and page lists draw in it.
func (*Model) View ¶
View renders the shell as a full-screen tea.View; View().Content is the string. The terminal cursor follows the rendered block through the page or modal that holds it: a bar in insert mode, a block in normal mode and an underline in visual modes. It is hidden when the block reports no cursor.
type NoticeID ¶ added in v0.4.0
type NoticeID uint64
NoticeID names one notice so the code that posted it can clear it. The UI assigns it, whatever sink shows the notice (or none), so a handler can always clear what it posted.
type Noun ¶
type Noun struct {
Name string `json:"name"`
Verbs []string `json:"verbs,omitempty"`
Pin string `json:"pin,omitempty"`
Focusable bool `json:"focusable,omitempty"`
Region bool `json:"region,omitempty"`
Bindings map[string][]Binding `json:"bindings"`
Extends map[string]string `json:"extends,omitempty"`
Guards map[string]string `json:"guards,omitempty"`
// Availability are the guards added to a verb beside its own
// (Runtime.AddVerbAvailability), by verb: every one must hold too.
Availability map[string][]string `json:"availability,omitempty"`
Actions map[string]Handler `json:"-"`
// Columns are the table columns a list of the noun's rows draws
// (NounBuilder.Columns, the catalog's columns): declared data a host
// passes to Columns when it builds the list, never applied on its own.
Columns []Column `json:"columns,omitempty"`
// Completions are the completion triggers of the noun's inputs that
// declare none of their own (NounBuilder.Completions).
Completions []CompletionTrigger `json:"-"`
// Props are the fields of the noun's things (NounBuilder.Props,
// props.go), in declaration order; Store is its store row
// (NounBuilder.Store), nil when it declares none.
Props []PropSpec `json:"props,omitempty"`
Store *Store `json:"-"`
}
Noun is the behaviour shared by every instance of one kind: the verbs it answers to, its key bindings per mode, the action handlers that override an operation's default while the noun is on the focus stack, and an optional pinned mode (the prompt noun pins insert). Focusable marks every instance of the noun as a focus stop (focus.next and the mode rule read it); Region marks a grouping that focus.next {scope: "region"} jumps between.
Bindings is keyed by mode name. "" holds rows that apply in every base mode; a pending mode (operator_pending, a key-sequence prefix, ...) is exclusive and reads only its own table.
type NounAlias ¶ added in v0.16.0
type NounAlias struct {
Alias string `json:"alias"`
Noun string `json:"noun"`
Shadowed bool `json:"shadowed,omitempty"`
Since string `json:"since,omitempty"`
RemoveAfter string `json:"removeAfter,omitempty"`
Note string `json:"note,omitempty"`
}
NounAlias is one alias: the short name, the noun it names, and whether an application noun of that name shadows it (the short name then reaches the application's noun and the framework's stays reachable by Noun). Since and RemoveAfter mark a deprecated alias (an old name kept for a release after a rename, Keep actions); Note is free text its notice adds.
func (NounAlias) Deprecated ¶ added in v0.57.0
Deprecated reports whether the alias is an old name on its way out.
type NounBuilder ¶
type NounBuilder struct {
// contains filtered or unexported fields
}
NounBuilder is the declaration surface of one noun.
func (*NounBuilder) Action ¶
func (b *NounBuilder) Action(key string, h Handler) *NounBuilder
Action overrides any operation ("noun.verb") while this noun is on the stack.
func (*NounBuilder) Alias ¶ added in v0.28.0
func (b *NounBuilder) Alias(verbs ...string) *NounBuilder
Alias makes each name another verb of this noun for the last declared verb (show for get, forget for kill): a permanent alias. A name may hold a dot (base.add). It panics on a clash (AddActionAlias), as Verb does on a duplicate.
func (*NounBuilder) AliasOn ¶ added in v0.28.0
func (b *NounBuilder) AliasOn(noun, verb string) *NounBuilder
AliasOn makes noun.verb another name of the last declared verb: one operation reachable under both nouns' names (project.associate for pane.associate). The handler reads which side named it from Ctx.Invoked.
func (*NounBuilder) Columns ¶
func (b *NounBuilder) Columns(cols ...Column) *NounBuilder
Columns declares the table columns a list of the noun's rows draws, in order, each row's ListItem.Cells the same order (Noun.Columns). The catalog carries them, so a host mounting the noun's rows draws a table; an application passes r.Noun(noun).Columns to the Columns list option.
func (*NounBuilder) Completions ¶ added in v0.5.0
func (b *NounBuilder) Completions(triggers ...CompletionTrigger) *NounBuilder
Completions declares the completion triggers of every input of the noun that has none of its own (Input.Completions).
func (*NounBuilder) Confirm ¶
func (b *NounBuilder) Confirm(prompt string) *NounBuilder
Confirm asks before the last declared verb runs: the prompt template ({{id}}, {{noun}}, {{<arg>}}) opens a confirm modal whose y runs the stored request and n or esc pops it. An empty prompt removes the confirm.
func (*NounBuilder) Fetch ¶ added in v0.7.0
func (b *NounBuilder) Fetch() *NounBuilder
Fetch marks the last declared verb as a data request (Operation.HistoryKind HistoryFetch): a state, list or show verb. Its calls are history entries of kind fetch, which history.list leaves out by default and the ring bounds apart from the user's actions and changes.
func (*NounBuilder) Focusable ¶
func (b *NounBuilder) Focusable() *NounBuilder
Focusable makes every instance of the noun a focus stop.
func (*NounBuilder) Many ¶ added in v0.36.0
func (b *NounBuilder) Many() *NounBuilder
Many marks the last declared verb as taking many subjects at once (Operation.Many): run over a visual selection, its handler is called once with every selected row in Ctx.Subjects instead of once per row. Use it for a verb that asks something (a chooser, a confirm naming what it affects) or that should make one change and one notice for all.
func (*NounBuilder) Mode ¶
func (b *NounBuilder) Mode(mode string) *ModeBuilder
Mode selects the table rows are bound into; "" is the any-mode table.
func (*NounBuilder) Motion ¶
func (b *NounBuilder) Motion() *NounBuilder
Motion marks the last declared verb as a motion (Operation.Motion): the footer leaves its rows to ? help, as it does for list.move.
func (*NounBuilder) Noun ¶
func (b *NounBuilder) Noun() *Noun
func (*NounBuilder) PersistArgs ¶ added in v0.2.0
func (b *NounBuilder) PersistArgs() *NounBuilder
PersistArgs marks the last declared verb's text-like arguments as safe to keep in the history file (Operation.PersistArgs).
func (*NounBuilder) Pin ¶
func (b *NounBuilder) Pin(mode string) *NounBuilder
Pin keeps every instance of the noun in one base mode.
func (*NounBuilder) Positional ¶
func (b *NounBuilder) Positional(names ...string) *NounBuilder
Positional names the parameters of the last declared verb that bare words fill first, in order (Operation.Positional): Positional("name") makes BIN project link foo set name even though the boolean all sorts first. The CLI gives a boolean a bare word only when it is named here.
func (*NounBuilder) Props ¶ added in v0.52.0
func (b *NounBuilder) Props(props ...PropSpec) *NounBuilder
Props declares props of the noun (see PropSpec), in order. It panics on a bad declaration: a name that is not one word, a standard verb's name, a name the noun's verbs or a nested noun already take, a second prop of that name, an unknown type, or a bad role. Declared after Store, the standard verbs follow the new props.
func (*NounBuilder) Quiet ¶
func (b *NounBuilder) Quiet() *NounBuilder
Quiet marks the last declared verb as bookkeeping (Operation.Quiet): its jobs stay off the jobs ticker. The framework names no quiet verb.
func (*NounBuilder) Region ¶
func (b *NounBuilder) Region() *NounBuilder
Region makes every instance of the noun a focus region: a grouping (a panel) that focus.next {scope: "region"} jumps between, never a stop.
func (*NounBuilder) Renamed ¶ added in v0.28.0
func (b *NounBuilder) Renamed(old, since, removeAfter string) *NounBuilder
Renamed keeps old, the verb's name before a rename, as a deprecated alias of the last declared verb: since is the release that renamed it and removeAfter the last release that keeps the old name (one release, per Keep actions; record it in the CHANGELOG). Its first use posts a one-time notice naming the new name.
func (*NounBuilder) Rows ¶
func (b *NounBuilder) Rows(noun string) *NounBuilder
Rows declares that the last declared verb's result lists rows of noun (Operation.Rows): a host reading the catalog knows which noun a list verb's rows answer to. An empty noun removes the declaration.
func (*NounBuilder) State ¶
func (b *NounBuilder) State() *NounBuilder
State marks the last declared verb as the runtime's state source (Operation.State): one call answers every list's rows as JSON Lines, each line tagged with the list noun (see cli.CatalogDoc). A host reading the catalog's state runs it once instead of one row source per list. The framework names no state verb.
func (*NounBuilder) Store ¶ added in v0.52.0
func (b *NounBuilder) Store(s Store) *NounBuilder
Store declares the noun's store row and registers the standard verbs it supports (standard_verbs.go). Props come first. It panics when the noun has no props, the kind is unknown, the key props do not fit the kind (one Key prop for a collection or instances, none for a singleton), or a role, fallback or list parameter is wrong.
func (*NounBuilder) TextResult ¶ added in v0.55.0
func (b *NounBuilder) TextResult() *NounBuilder
TextResult marks the last declared verb's result as text (Operation.Result ResultText): the palette opens what it answers in the text view, a read-only editor. A string is shown as it is; any other value as indented JSON.
func (*NounBuilder) Verb ¶
func (b *NounBuilder) Verb(verb string, h any, description ...string) *NounBuilder
Verb registers noun.verb as an operation when it is new, else installs the handler as this noun's override of the existing operation. The handler is a Handler (an interaction verb, run on the loop) or an AppHandler (func(Ctx) Result: an application verb whose pending work runs off the loop). An override of an existing operation must be a Handler.
func (*NounBuilder) Verbs ¶
func (b *NounBuilder) Verbs(verbs ...string) *NounBuilder
Verbs records the verbs the noun answers to, for help and the palette.
func (*NounBuilder) When ¶
func (b *NounBuilder) When(guard string) *NounBuilder
When guards the last declared verb with a registered guard name: while the guard is false at the focus and mode the verb would run in, the palette does not offer it. The guard reads a KeyEvent whose Focus and Level are that focus and whose Mode is that mode. A palette noun's default verb is never guarded (RegisterNoun refuses one). An empty name removes the guard.
type NounPlace ¶ added in v0.15.0
type NounPlace struct {
Noun string `json:"noun"`
Ancestors []string `json:"ancestors"`
Page string `json:"page,omitempty"`
PageTitle string `json:"pageTitle,omitempty"`
Modal string `json:"modal,omitempty"`
Count int `json:"count"`
First time.Time `json:"first"`
Last time.Time `json:"last"`
}
NounPlace is one place a noun was seen: an instance of Noun registered under instances of the Ancestors nouns (outermost first, app left out), on Page, or inside the open modal Modal. Inside a modal the ancestors start at the modal instance, where the stack walk stops; Page is then the page the modal opened over. Instance ids are never part of a placement (rows and generated instances differ per run), only nouns and the page id (page ids are stable). A list row counts once per SetItems for each noun its rows answer to, not once per row.
type NounWord ¶ added in v0.53.0
NounWord is how the word after a noun reads (ReadNounWord): Kind is NounWordVerb or NounWordProp with Value the whole word, or "" when it is neither (a key or an instance: the caller's own reading), with Candidates when it is a prefix of several verbs or several props.
type Operation ¶
type Operation struct {
Verb string `json:"verb"`
Noun string `json:"noun"`
Description string `json:"description"`
Parameters map[string]Parameter `json:"parameters"`
Result string `json:"result"`
Kind string `json:"kind"`
Confirm string `json:"confirm,omitempty"`
Repeatable bool `json:"repeatable,omitempty"`
// Rows names the noun whose rows the verb's result lists (a list
// verb's JSON array of rows of that noun); "" when the result is not
// rows. It is data for hosts (the catalog's rows); the runtime does
// not read it.
Rows string `json:"rows,omitempty"`
// State marks the verb whose answer is the rows of every one of a
// host's lists in one call (NounBuilder.State), as JSON Lines of
// cli.Row tagged by list noun ({"noun":"agent","id":..,"label":..}).
// Data for hosts (the catalog's state); the runtime does not read it.
State bool `json:"state,omitempty"`
// Quiet marks bookkeeping (a list reload) the jobs ticker does not
// show; set by NounBuilder.Quiet. The catalog's quiet.
Quiet bool `json:"quiet,omitempty"`
// Builtin marks an operation the framework registered itself: every
// one NewRuntime and NewModel register, and those a framework
// constructor registers later (NewPicker, NewPalette, grid.Register,
// markdown.Register, cli.AddCommands), each inside Runtime.Builtin. An
// application's verb is never builtin, even on a framework noun
// (history.capture-hook). Data for hosts (the catalog's builtin): a
// host mounting another tool's verbs skips these, which every
// ochazuke tool has; the runtime does not read it.
Builtin bool `json:"builtin,omitempty"`
// PersistArgs lets the history file keep this operation's arguments
// named like text (text, value, keys, args, password, secret, token), which
// it otherwise leaves out; set by NounBuilder.PersistArgs. Only for an
// operation whose arguments are never typed secrets (settings.set).
PersistArgs bool `json:"persistArgs,omitempty"`
// Motion marks movement (list.move, focus.next, surface.scroll,
// page.next): the footer's hint line leaves its rows out, since motions
// are standard and the footer is for the verbs the focus offers; ?
// help and bindings list keep them. Set by NounBuilder.Motion; the
// framework's own motions are marked as they register (motionOps).
Motion bool `json:"motion,omitempty"`
// Typing marks an operation that passes the key that ran it on as
// content rather than acting on it as a command: typing into an input
// (input.insert), keys forwarded to a pane (terminal.send,
// terminal.paste). The key echo (keys.echo) collapses a run of them
// into the text typed, and hides the ones a passthrough mode forwards
// unless keys.echo-terminal is on. The framework's own are marked as
// they register (typingOps).
Typing bool `json:"typing,omitempty"`
// HistoryKind is the kind of entry the operation records
// (HistoryAction, HistoryChange, HistoryFetch); empty derives it
// (HistoryKindOf). Set it to HistoryFetch on a verb that only asks for
// data (NounBuilder.Fetch, the catalog's history), so history.list's
// default view and the bounded ring leave its calls to the fetches.
HistoryKind string `json:"historyKind,omitempty"`
// Positional names the parameters bare words fill first, in this
// order (NounBuilder.Positional), ahead of ParameterOrder's
// required-then-by-name rest. The CLI gives a boolean a bare word only
// when it is named here. The catalog's positional.
Positional []string `json:"positional,omitempty"`
// Many marks a verb whose handler takes every subject of a request at
// once (Ctx.Subjects: a visual selection's rows), so it asks one
// question, makes one change and posts one notice for all of them; set
// by NounBuilder.Many. A verb without it that is asked to act on
// several subjects runs once per subject. The catalog's many.
Many bool `json:"many,omitempty"`
// Aliases are the action's other names (ActionAlias), display
// spelling, sorted. Catalog and operations.list fill it; an entry of
// Runtime.Operations does not hold it (the alias table does).
Aliases []string `json:"aliases,omitempty"`
// Standard is the standard verb (standard_verbs.go: get, list) the
// runtime generated this operation from for a noun with a store, ""
// for every verb written by hand. An application verb of the same key
// replaces a standard one, registered before or after. The catalog's
// standard.
Standard string `json:"standard,omitempty"`
// Checks run before the verb from every path (AddVerbCheck,
// BeforeQuit, verb_checks.go): each allows, asks first or refuses.
Checks []VerbCheck `json:"-"`
// ConfirmFor, when set, is the prompt template one request asks in
// place of Confirm (given as prompt), read when the request would ask:
// a verb whose confirm depends on what it will do to the thing (the
// standard delete under delete.archive). "" asks nothing.
ConfirmFor func(r *Runtime, c Context, q Request, prompt string) string `json:"-"`
Run Handler `json:"-"`
App AppHandler `json:"-"`
}
Operation is one registered noun.verb. Kind is "interaction" (the default: Run executes synchronously on the loop) or "application" (App is an AppHandler whose pending work runs off the loop and reports through the delivery contract). Confirm, when set, is a prompt template ({{id}}, {{noun}}, {{label}}, {{<arg>}}) shown in a confirm modal before the operation runs. Repeatable marks a change (not a motion or navigation) that dot-repeat (history.repeat, bound to . on app in normal mode) may run again; set it on the Operation passed to Register.
func (Operation) HistoryKindOf ¶ added in v0.7.0
HistoryKindOf is the kind of history entry the operation records: its HistoryKind when set; else a fetch for a verb that answers rows (Rows, State), a change for a Repeatable one, an action for a Motion, a change for any other application verb (work that may change something outside the runtime: the safe reading of an extension verb that declares nothing), and an action for any other interaction verb.
func (Operation) ParameterOrder ¶
ParameterOrder lists the operation's parameters in positional order: the Positional names first, in their order, then the rest required first, then by name. Parameters is a map, so this is the declared order the palette's words and the CLI's bare arguments fill.
func (Operation) RestParameter ¶ added in v0.50.0
RestParameter is the name of the operation's rest-of-line parameter (Parameter.Rest), "" when it has none.
func (Operation) SubjectOmitted ¶ added in v0.53.0
SubjectOmitted reports whether word, met where the first of open (the parameters still unfilled, in line order) is a subject filled from the focus (Parameter.Focus), is the next parameter's word instead: one of its Enum values, or NAME=VALUE with NAME one of them when it takes Pairs. The subject then comes from the focus, a target or --KEY (the flag named after the key prop). A thing whose key equals a prop name is reached with --KEY.
func (Operation) WithPresets ¶ added in v0.55.0
WithPresets is args with presets (an action alias's arguments) filling what args leaves out: a caller's argument wins over a preset of the same name, and over a preset it excludes or that excludes it (Parameter.Excludes: star, task.set {toggle: true}, given value: false writes false). args is not changed.
type Origin ¶ added in v0.50.0
type Origin struct {
Layer string `json:"layer"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
By string `json:"by,omitempty"`
Source string `json:"source,omitempty"`
Via string `json:"via,omitempty"`
At time.Time `json:"at,omitzero"`
Disk time.Time `json:"disk,omitzero"`
}
Origin is where a setting's value comes from, as :verbose names it. Layer is OriginDefault, OriginFile or OriginSession. For a default, Path is the embedded settings file (settings/ochazuke.json) or the application's file:line that declared it, and By is "ochazuke" or "app". For the file, Path is settings.json and Line the line of its key (0 when not found). For a session value, Source is the history source of the request that set it ("palette", "key:<keys>", "cli", "api", "macro:<r>"), Via the name it ran by (an alias such as setting.save, or the action's key) and At the time. Disk, when set, is when the poll (or settings.reload) read another value for the setting from settings.json: another process changed it under this runtime.
type OverlayMark ¶ added in v0.14.0
type OverlayMark struct {
Row int `json:"row"`
Col int `json:"col"`
Text string `json:"text"`
Style lipgloss.Style `json:"-"`
}
OverlayMark is plain text drawn from one cell of the frame (Row and Col, 0-based, in the pane's cells) to the right, cut at the frame's edge; a wide rune it half covers becomes a space. Style draws the text; the empty style draws it reverse and bold, so a mark stands out in mono too. Marks are drawn in order, a later one over an earlier one.
type Page ¶
type Page struct {
ID string `json:"id"`
Title string `json:"title"`
Focus string `json:"focus"`
Remembered string `json:"remembered"`
Render func(*Runtime, int, int) Block `json:"-"`
// OnOpen, when set, runs on the loop each time OpenPage makes this page
// current from another page (or from none: the first page opened), after
// the focus and mode are restored; from is the page left, "" for none.
// Reopening the current page does not run it. An application refreshes
// what the page shows here (SetItems, or Launch a reload job owned by
// one of its instances) instead of polling. Every way a page opens goes
// through OpenPage: page.open, page.next/previous, ctrl+j/k, the page
// picker.
OnOpen func(r *Runtime, from string) `json:"-"`
// Scrolloff is how many lines the page keeps visible above and below
// the focused element when it scrolls to follow the focus: 0 means the
// default, 2; a negative value keeps no margin.
Scrolloff int `json:"scrolloff,omitempty"`
// DefaultHidden declares the page hidden by default: an opt-in page,
// out of the tabs and ctrl+j/k until page.show brings it in. It is
// data for the pages.hidden setting's default (PagesHiddenSetting);
// the setting, once the user sets it, decides. Set it before
// RegisterPage, or pass the DefaultHidden option.
DefaultHidden bool `json:"defaultHidden,omitempty"`
// contains filtered or unexported fields
}
Page is the component a page instance fronts: a title, the instance it starts focused on (Focus), the focus it remembers while another page is open (Remembered, restored with its mode by OpenPage), and a renderer. Render returns the page body for the given cell bounds as a Block; its cursor, when the page holds the focused input, is relative to the body's top-left cell. Pages without inputs return Text(body).
type Palette ¶
type Palette struct {
// contains filtered or unexported fields
}
Palette is the ex-mode command line: one prompt input whose text is the source of truth, parsed by the grammar in palette_parse.go, with a completion list for the next word beneath it. It never edits the originating input. Create one palette per runtime: operation keys are globally unique.
func NewPalette ¶
NewPalette returns the command palette for r.
func (*Palette) RegisterNoun ¶
func (p *Palette) RegisterNoun(noun string, config PaletteNoun) error
RegisterNoun adds or replaces a live instance source without changing operation forms.
type PaletteEntry ¶
type PaletteEntry struct {
Value string `json:"value"`
Kind string `json:"kind"`
Label string `json:"label"`
ID string `json:"id,omitempty"`
Verb string `json:"verb,omitempty"`
// Aliases are the other verb words that name this entry's action
// (ActionAlias): typing one narrows to this entry, which is listed
// once under its canonical name.
Aliases []string `json:"aliases,omitempty"`
// Splice marks a rest parameter's completion (Parameter.Rest): taking
// it puts Value in place of the line from From (a rune offset) to the
// cursor, adding no space, instead of replacing the word being typed.
Splice bool `json:"splice,omitempty"`
From int `json:"from,omitempty"`
}
PaletteEntry is one completion: Value is the word it appends, Kind is verb, noun or choice, Label what the list shows.
type PaletteInstance ¶
type PaletteInstance struct {
ID string `json:"id"`
Label string `json:"label"`
// Word is the word the palette offers and takes for it ("" the id):
// a page's title (Choice.Word).
Word string `json:"word,omitempty"`
}
PaletteInstance is a labeled object whose ID becomes the default action argument.
func PagesPaletteSource ¶
func PagesPaletteSource(r *Runtime, _ Context) []PaletteInstance
PagesPaletteSource reads the runtime registry on every listing, not at startup.
type PaletteNoun ¶
type PaletteNoun struct {
Source PaletteSource
DefaultVerb string
Argument string
}
PaletteNoun explicitly chooses the action and string argument used for an instance.
type PaletteSource ¶
type PaletteSource func(*Runtime, Context) []PaletteInstance
PaletteSource reads current instances in the context captured when the palette opened.
type PaletteWord ¶
type PaletteWord struct {
Text string `json:"text"`
Kind string `json:"kind,omitempty"`
Value string `json:"value,omitempty"`
Param string `json:"param,omitempty"`
Candidates []string `json:"candidates,omitempty"`
}
PaletteWord is one word of the line and what it resolved to: Kind is verb, noun, instance or argument; Value is the full word ("" while it is unresolved); Candidates are the words an ambiguous prefix could be.
type ParamAlias ¶ added in v0.58.0
type ParamAlias struct {
Alias string `json:"alias"`
Param string `json:"param"`
Since string `json:"since,omitempty"`
RemoveAfter string `json:"removeAfter,omitempty"`
Note string `json:"note,omitempty"`
}
ParamAlias is an old name of a parameter, taken by the action alias that declares it (Keep actions, for a parameter: a renamed flag works for one release). Alias is the old name, Param the parameter of the alias's action it fills. Since and RemoveAfter date a deprecated one: its first use in a runtime posts a one-time notice naming the new name. An old name is read from the CLI (--starred), the palette (--starred), binding rows' args and the API alike; it is never completed and help never lists it. The parameter's own name wins when both are given.
func (ParamAlias) Deprecated ¶ added in v0.58.0
func (p ParamAlias) Deprecated() bool
Deprecated reports whether the old name is on its way out.
type Parameter ¶
type Parameter struct {
Type string `json:"type"`
Required bool `json:"required,omitempty"`
Description string `json:"description,omitempty"`
// Enum lists the static choices of a string parameter; Source names an
// operation (noun.verb) whose result lists more. Free also accepts a
// value outside them.
Enum []string `json:"enum,omitempty"`
Source string `json:"source,omitempty"`
Free bool `json:"free,omitempty"`
// Noun says the value names one of that noun's things: a row of its
// list verb (NOUN.list, when it is a read with no required parameter,
// stands in for an empty Source), else the id of a live instance of
// the noun. A Source still wins; Enum values come first.
Noun string `json:"noun,omitempty"`
// A path parameter (Type "path") names a file, or a folder when Path
// is "dir"; its form field opens the path chooser (path_chooser.go),
// whose browse starts at Base (~ and relative to the working
// directory) when the field is empty. New allows a path that does not
// exist yet (a file to write).
Path string `json:"path,omitempty"`
Base string `json:"base,omitempty"`
New bool `json:"new,omitempty"`
// Rest marks a string parameter that takes the rest of the line,
// verbatim: the palette hands it the text from its first word to the
// end, quotes and spaces as typed, and the CLI joins the remaining
// words with spaces. A verb has at most one, the last its words fill
// (settings.apply's line: :set scrolloff=5 nowrap). Its Source is asked
// with the text as the query and, when it declares
// ChoicesCursorParameter, the cursor in it; each choice's id is the
// text up to the cursor with the completion in place.
Rest bool `json:"rest,omitempty"`
// Focus declares that an omitted value is filled from the focus: the
// instance the request acts for once ExecuteAt has applied its target
// and the focus path (Ctx.Instance, or the nearest instance of Noun
// above it). A standard verb's subject parameter (standard_verbs.go)
// declares it, and so does a create parameter of a FromFocus prop;
// values never come from the focus unless their parameter says so,
// and a fill is always shown (the palette slot, the args form). The
// catalog's focus.
Focus bool `json:"focus,omitempty"`
// Edits names the prop of the subject this parameter writes (rename's
// name writes the label prop): the args form opens holding the prop's
// current value, selected as a rename is (rename.select), or, when it
// is empty, empty with the prop's Fallback value as its placeholder.
Edits string `json:"edits,omitempty"`
// ValueOf names the parameter whose argument is a prop of the
// operation's noun: this parameter holds a value of that prop, so its
// choices (and the palette's check of a typed word) are the prop's own
// (its Enum, Source or Noun; true and false for a boolean). A standard
// set's value declares ValueOf "prop". The catalog's valueOf.
ValueOf string `json:"valueOf,omitempty"`
// Pairs marks a parameter that takes NAME=VALUE words of the noun's
// props (where, set's several-prop form): a word holding = completes
// the values of prop NAME; one without completes the Enum when there
// is one, else NAME= for each prop. The catalog's pairs.
Pairs bool `json:"pairs,omitempty"`
// Excludes names the parameters a request cannot give with this one
// (set's toggle and value). A preset (an action alias's args) that a
// caller's argument excludes, or that excludes it, yields to the
// caller's (Operation.WithPresets). The catalog's excludes.
Excludes []string `json:"excludes,omitempty"`
}
Parameter describes one argument of an operation: its type, whether it is required, and its choices.
type PathChooserSpec ¶ added in v0.44.0
type PathChooserSpec struct {
Kind string // default PathChooserKind
Title string // default "Choose <name>"
Pick PathPick
// Source names the source to open on (PathSourceBrowse, an
// application's AddPathSource name); "" (or a source this pick leaves
// out) opens on the one chooser.remember-source gives, else browse.
Source string
// Choose takes the path; nil returns it as the result.
Choose func(path string) Result
}
PathChooserSpec opens a path chooser. Choose takes the chosen path (absolute, cleaned).
type PathPick ¶ added in v0.44.0
type PathPick struct {
// Name is the parameter (or field) name; Parameter its description
// (Path, Base, New).
Name string
Parameter Parameter
// Value is the field's value when the chooser opened.
Value string
// Start is the folder browse starts in (PathStart), filled in by
// OpenPathChooser.
Start string
}
PathPick describes what a path chooser is open for.
type Payload ¶
type Payload struct {
Return string `json:"return,omitempty"`
Count int `json:"count,omitempty"`
OpCount int `json:"opCount,omitempty"`
Op string `json:"op,omitempty"`
Prefix string `json:"prefix,omitempty"`
Prompt string `json:"prompt,omitempty"`
Request *Request `json:"request,omitempty"`
Shadow *ModeState `json:"shadow,omitempty"`
// Anchor is the instance a modal is opened for (a form field, for its
// chooser): the modal is drawn beside it (modal.anchor).
Anchor string `json:"anchor,omitempty"`
}
Payload is the small typed state a mode carries (Runtime.Mode.Payload). For a pending mode Return is the mode it returns to on leave. Count and OpCount are the Vim counts before and after an operator; Op is the pending operator; Prefix is the key sequence typed so far; Request is a stored request (the completed match a sequence prefix falls back to, or a confirm's deferred action); Prompt is the text a confirm modal shows; Shadow is the mode the macro_recording shadow mode re-dispatches in.
type Picker ¶
type Picker struct {
Runtime *Runtime
Origin Context
Directory string
Filter string
Entries []PickerEntry
Selected int
Error string
Loading bool
// contains filtered or unexported fields
}
Picker owns one modal and one ordinary editor. Background commands only read immutable snapshots; HandleMessage is the sole result-application boundary. Its work runs as four replacing jobs on the picker instance (the "index", "search", "preview" and "stat" slots), so the runtime's jobs list decides which result is current: a newer job in a slot drops the older, and Close cancels them all.
func (*Picker) Close ¶
func (p *Picker) Close()
Close cancels indexing, searching and previews; the picker instance stays registered for the next open.
func (*Picker) HandleMessage ¶
HandleMessage applies only the current job of each slot (index, search, preview) on the UI loop; the runtime's jobs list says which that is.
func (*Picker) MatchMode ¶ added in v0.59.0
MatchMode is the picker's match mode: the one search.cycle-match or search.set-match chose while it is open, else the chooser.match setting. It decides how the query (the path after its directory) picks entries.
func (*Picker) PendingCommand ¶
PendingCommand is drained by Runtime.PendingCommands after every event, including CallMsg. It schedules work, never waits on filesystem or search.
type PickerEntry ¶
PickerEntry is relative to the indexed root. Symlinks are selectable files, never traversal edges.
type Placement ¶
type Placement struct {
ID string `json:"id"`
// Line is the body line the view's first line landed on, -1 when the
// view reported no text or the page did not draw it; Height is its line
// count.
Line int `json:"line"`
Height int `json:"height"`
// Focus and FocusHeight are the focused lines, relative to Line.
Focus int `json:"focus"`
FocusHeight int `json:"focusHeight"`
}
Placement is one Placed call of a frame: the instance drawn and, when its view reported them (PlacedAt), the lines it covers in the page body and the lines inside it that hold the focus (a list's selected row, a grid's cursor row, an input's whole box, a terminal's top line).
type Pos ¶
type Pos struct {
X, Y int
}
Pos is a cell position inside a rendered block: zero-based, counted from the block's top-left corner.
type Predicate ¶
type Predicate struct {
Name string `json:"name"`
Arg string `json:"arg,omitempty"`
Of []Predicate `json:"of,omitempty"`
}
Predicate is one named test over an instance: a value, never a string selector. A query is a list of predicates, ANDed. Name is a registered predicate (noun, id, kind, within, child-of, focusable, region, state or one an application adds) and Arg its argument; the combinators any, all and not take nested predicate lists in Of instead. The wire form is a JSON array: ["noun","row"], ["any",[["noun","a"],["noun","b"]]].
func IsFocusable ¶
func IsFocusable() Predicate
func ParsePredicates ¶
ParsePredicates reads the wire form: a list of [name, arg] pairs, or [combinator, [nested pairs]] for any, all and not. A []Predicate from Go passes through.
type PredicateFunc ¶
PredicateFunc tests one instance; arg is the predicate's argument.
type PropSpec ¶ added in v0.52.0
type PropSpec struct {
Name string `json:"name"`
Parameter
ReadOnly bool `json:"readOnly,omitempty"`
CreateOnly bool `json:"createOnly,omitempty"`
Key bool `json:"key,omitempty"`
Role string `json:"role,omitempty"`
Fallback string `json:"fallback,omitempty"`
FromFocus bool `json:"fromFocus,omitempty"`
Default any `json:"default,omitempty"`
Secret bool `json:"secret,omitempty"`
Multiline bool `json:"multiline,omitempty"`
When string `json:"availability,omitempty"`
}
PropSpec is one field of a noun's things. Parameter carries the type, Required, Enum, Source, Noun and Description, as a verb parameter does, so the palette, CLI help and forms read it unchanged; Type is a setting type or PropObject ("" is string). A prop whose Parameter.Noun is set is a reference: its value is the key of one of that noun's things.
ReadOnly props are never written by set (a Key prop always is); CreateOnly ones are written by create only. Role gives the prop a part (RoleLabel, RoleOwner). Fallback names another prop of the noun shown in this prop's place when this one is empty: display only (list rows, {{label}}, choosers); get still reads the prop itself. Default is what create writes when the value is omitted. A Secret prop is left out of get's and list's records unless asked for by name, and its writes are never repeated or persisted. Multiline asks a form for a text area. FromFocus, on a reference prop, lets create fill it from the focused thing of its noun when the request omits it (the create.from-focus setting, on by default; the fill is always shown: the palette slot and the args form hold it, and create's notice names it). Values are never read from the focus unless their prop says so. When names a guard: where it is false (read where the request acts) the prop is not offered, read or written (the catalog's availability); the guard is the prop's own, apart from the noun's verb guards.
type QueryMatch ¶
type QueryMatch struct {
ID string `json:"id"`
Noun string `json:"noun"`
Parent string `json:"parent,omitempty"`
}
QueryMatch is one instances.query result row.
type Record ¶ added in v0.2.0
Record is one record's values by field name, as an editor loads and writes them.
type RecordDebounceMsg ¶ added in v0.2.0
RecordDebounceMsg is the timer a pause in typing sets off: when Seq is still the editor's latest change, the record is written.
type RecordEditor ¶ added in v0.2.0
type RecordEditor struct {
// Styles colour the labels (the zero value draws them plain); a modal
// editor uses the Model's.
Styles Styles
// contains filtered or unexported fields
}
RecordEditor is a form over one record: a field per schema entry, each a focus stop, and every change written as it is made. Typing in a text field is written after a pause (Debounce) and at once when the field is left or insert mode ends; a choice, an edit in normal mode, an undo or a redo is written at once. A value that is not valid (Required, the type, the choices, Validate) is not written, and its label says why. u and ctrl+r undo and redo the record's written changes, each written like any other; q and esc leave, and nothing is ever discarded. There is no save key.
The editor is an instance of the form noun (id) with a child per field (id/name): text fields are inputs of form-field (form-text when multiline), choice fields instances of form-choice, whose enter opens the chooser (a modal list of form-option rows).
func (*RecordEditor) Block ¶ added in v0.2.0
func (e *RecordEditor) Block(width, height int) Block
Block draws the form: per field its label (with why a value is not written) and its value, a text field as its input, a choice field as its value with the one highlight while focused; a failed write is the last line. Each field is placed in drawing order, so motions follow it.
func (*RecordEditor) Close ¶ added in v0.2.0
func (e *RecordEditor) Close()
Close writes what is pending (the editor is being removed). It is the delivery contract's Close: to close an editor, an application calls Leave, which also removes it (a closed editor's id is free again either way).
func (*RecordEditor) Closed ¶ added in v0.2.0
func (e *RecordEditor) Closed() bool
Closed reports whether the editor was left (form.leave) or removed.
func (*RecordEditor) DebounceCurrent ¶ added in v0.2.0
func (e *RecordEditor) DebounceCurrent(tick RecordDebounceMsg) bool
DebounceCurrent reports whether a pause timer is for the latest change.
func (*RecordEditor) DebounceTick ¶ added in v0.16.0
func (e *RecordEditor) DebounceTick() (RecordDebounceMsg, bool)
DebounceTick is the pause timer in flight, for a host that delivers it at once (explore): false when no change waits on one.
func (*RecordEditor) Failure ¶ added in v0.2.0
func (e *RecordEditor) Failure() error
Failure is the last background failure, cleared when read.
func (*RecordEditor) Flush ¶ added in v0.2.0
func (e *RecordEditor) Flush() error
Flush writes what is pending now (on quit).
func (*RecordEditor) Focus ¶ added in v0.2.0
func (e *RecordEditor) Focus() error
Focus focuses the first field (the spec's Start; in insert mode when the spec says so).
func (*RecordEditor) FocusTarget ¶ added in v0.2.0
func (e *RecordEditor) FocusTarget() string
FocusTarget is where a jump to the editor lands: its first field (the spec's Start).
func (*RecordEditor) HandleMessage ¶ added in v0.2.0
func (e *RecordEditor) HandleMessage(msg tea.Msg) bool
HandleMessage writes the record when its pause timer is the latest.
func (*RecordEditor) ID ¶ added in v0.2.0
func (e *RecordEditor) ID() string
ID is the editor's instance id.
func (*RecordEditor) Leave ¶ added in v0.54.0
func (e *RecordEditor) Leave() error
Leave writes what is pending and closes the editor, as form.leave does: a modal editor's modal closes, the editor's instance is removed (the focus goes where FocusOnClose says) and OnLeave runs.
func (*RecordEditor) ModalBlock ¶ added in v0.2.0
func (e *RecordEditor) ModalBlock(s Styles, width, height int) Block
func (*RecordEditor) ModalTitle ¶ added in v0.2.0
func (e *RecordEditor) ModalTitle() string
ModalTitle and ModalBlock draw a modal editor (ModalBody).
func (*RecordEditor) PendingCommand ¶ added in v0.2.0
func (e *RecordEditor) PendingCommand() tea.Cmd
PendingCommand notices changes: typing in a text field sets the pause timer; leaving a field, ending insert mode or any other change writes at once and closes the field's undo step.
func (*RecordEditor) Problem ¶ added in v0.2.0
func (e *RecordEditor) Problem(name string) string
Problem says why a field's value is not written, "" when it is.
func (*RecordEditor) Ran ¶ added in v0.36.0
func (e *RecordEditor) Ran() bool
Ran reports whether form.run handed the values to Submit.
func (*RecordEditor) Reload ¶ added in v0.54.0
func (e *RecordEditor) Reload() error
Reload loads the record again (Spec.Load) and takes in what changed outside the editor; what it does then follows forms.outside-write, as a RecordSpec.Watch event does.
func (*RecordEditor) Runnable ¶ added in v0.36.0
func (e *RecordEditor) Runnable() bool
Runnable reports whether form.run would run the form now: it has a Submit, is open, and every field is valid.
func (*RecordEditor) Values ¶ added in v0.2.0
func (e *RecordEditor) Values() Record
Values is every field's value as shown, valid or not.
func (*RecordEditor) WriteError ¶ added in v0.2.0
func (e *RecordEditor) WriteError() string
WriteError is the last write's failure, "" once a write succeeds.
func (*RecordEditor) Written ¶ added in v0.2.0
func (e *RecordEditor) Written() Record
Written is the record as written (or queued to be): the last valid value of every field.
type RecordField ¶ added in v0.2.0
type RecordField struct {
Name string `json:"name"`
Label string `json:"label,omitempty"` // shown above the value (default Name)
Parameter
Multiline bool `json:"multiline,omitempty"`
// Secret makes the field's input secret (Input.Secret): what is typed
// into it is never echoed. PropField sets it from a Secret prop.
Secret bool `json:"secret,omitempty"`
// Placeholder is shown, muted, in the field while its text is empty
// (a rename's Fallback: what the thing shows with no name).
Placeholder string `json:"placeholder,omitempty"`
// Validate checks a value the type, Required and the choices allow;
// its error is why the value is not written.
Validate func(value string) error `json:"-"`
}
RecordField is one editable field of a record schema. Its Parameter is the same description a verb's parameter carries (Type, Required, Enum, Source, Noun, Free, Description), so a form can come from a verb's catalog parameters (RecordFields). A field with choices (Enum, Source or Noun: Runtime.Choices) and not Free, or of Type boolean, is edited through a chooser, never as free text. A Free field with choices is a text field with suggestions (form-suggest): typing stays free text, enter in normal mode or ctrl+space opens the framework chooser over the suggestions (the Enum, then the Source's result, loaded off the loop when the Source verb is Pending), a pick fills the field and is written at once, and a value outside the suggestions is written as typed; it is one line high (Multiline is ignored). The rest are text inputs, Multiline ones several lines high.
func ArgsFields ¶ added in v0.36.0
func ArgsFields(op Operation) ([]RecordField, error)
ArgsFields is the args form's schema for a verb: its form-held parameters (RecordFields), the required ones first, an optional one's label marked "(optional)", a description after the name. It fails when a required parameter cannot be held by a field.
func PropField ¶ added in v0.53.0
func PropField(p PropSpec) RecordField
PropField is a prop as a form field (RecordField): its name, its parameter and whether it is multiline, so a record editor or an args form over a noun's things reads its props.
func RecordFields ¶ added in v0.2.0
func RecordFields(op Operation) []RecordField
RecordFields is a form's schema from a verb's parameters, in the order bare CLI words fill them (Operation.ParameterOrder): a mounted tool's edit verb gets a form from its catalog alone.
type RecordSpec ¶ added in v0.2.0
type RecordSpec struct {
Title string // the modal's title; a placed editor's heading is the application's
Fields []RecordField
// Load reads the record when the editor opens (nil: every field empty).
Load func() (Record, error)
// Save writes one change: Done, Failed, or Pending work that runs off
// the loop. At most one write is in flight; changes made meanwhile go
// in the next write. A failed write keeps the values on screen, says
// so, and is retried with the next change.
Save func(RecordWrite) Result
// Debounce is the pause in typing before a text field is written
// (DefaultRecordDebounce when zero).
Debounce time.Duration
// Insert opens the editor with the first field in insert mode when it
// is a text field.
Insert bool
// Rename says the editor renames a thing: it opens in insert like
// Insert, and with the start field's text selected (Input.SelectAll)
// while the rename.select setting is on, so typing replaces the name
// and a motion keeps it.
Rename bool
// OnLeave runs after the editor closed (form.leave, or form.run's
// Submit): every change is written or queued by then; a placed editor
// stops being drawn.
OnLeave func()
// Submit, when set, makes the editor a form that runs once instead of
// writing each change: Save is never called, changes stay on screen,
// and form.run (available once every field is valid) closes a modal
// editor and hands Submit every value as shown. A failed Submit
// reopens the modal with the values and the error (`! not run:`);
// leaving (form.leave, esc) runs nothing.
Submit func(Record) Result
// Start names the field focused first ("" the first field).
Start string
// Watch names the noun whose store holds the record: when its things
// change other than through this editor (a verb such as set, another
// client, Runtime.Changed), the open editor loads the record again
// (forms.outside-write: reload keeps it open, close leaves it). ""
// watches nothing; Reload does the same on the application's call.
Watch string
}
RecordSpec is what an application gives a record editor: the schema, how to load the record and how to write it.
type RecordWrite ¶ added in v0.2.0
RecordWrite is one write an editor hands Save: the record as it is to be stored (every field's last valid value) and the fields this write changes, in schema order.
func (RecordWrite) String ¶ added in v0.2.0
func (w RecordWrite) String() string
String reads a write in one line: "write title=milk status=doing", the changed fields in order (a value with spaces or empty is quoted).
type RecordingSink ¶ added in v0.4.0
type RecordingSink struct {
// contains filtered or unexported fields
}
RecordingSink is a UISink that keeps every message, for tests. Attach it with r.UI().Attach(&ochazuke.RecordingSink{}).
func (*RecordingSink) ClearNotice ¶ added in v0.4.0
func (s *RecordingSink) ClearNotice(id NoticeID)
ClearNotice records a clear.
func (*RecordingSink) Info ¶ added in v0.31.0
func (s *RecordingSink) Info(text string)
Info records a plain status.
func (*RecordingSink) LastError ¶ added in v0.36.0
func (s *RecordingSink) LastError() string
LastError is the last error status recorded (Error), "" for none.
func (*RecordingSink) LastInfo ¶ added in v0.31.0
func (s *RecordingSink) LastInfo() string
LastInfo is the last plain status recorded (Info), "" for none.
func (*RecordingSink) LastStatus
deprecated
added in
v0.4.0
func (s *RecordingSink) LastStatus() string
LastStatus is the last error status recorded.
Deprecated: use LastError.
func (*RecordingSink) Messages ¶ added in v0.4.0
func (s *RecordingSink) Messages() []UIMessage
Messages is a copy of what the sink recorded, in order.
func (*RecordingSink) Notices ¶ added in v0.4.0
func (s *RecordingSink) Notices() []string
Notices is the text of the notices still standing (posted and not cleared), oldest first.
func (*RecordingSink) Notify ¶ added in v0.4.0
func (s *RecordingSink) Notify(id NoticeID, text string)
Notify records a notice.
func (*RecordingSink) Status ¶ added in v0.4.0
func (s *RecordingSink) Status(text string)
Status records an error status (UIError).
type Registers ¶
type Registers struct {
Named map[string]Register
History []Yank
Active string
Macro MacroState
// Copy puts a yank's text on the system clipboard (the clipboard
// register + and the clipboard setting); nil sends it through the
// terminal as OSC 52 (tea.SetClipboard), which TUIOS and ssh pass on.
// An app with a clipboard program of its own (pbcopy) sets it.
Copy func(text string) tea.Cmd
// contains filtered or unexported fields
}
Registers is the component that owns the shared yanks, named registers, yank history, the register selected for the next operation and the macro state. It is one instance under app, reached through the register, macro and yank-history operations and Runtime.Registers(), never through Runtime fields. Its key rows (q, @, " and the pending modes they enter) sit on the app noun so a page or list focus can record and replay too.
func (*Registers) Close ¶
func (g *Registers) Close()
Close abandons a recording in progress; the registers themselves stay.
func (*Registers) HandleMessage ¶
HandleMessage: the registers do no off-loop work.
func (*Registers) PendingCommand ¶
PendingCommand copies the last yank bound for the system clipboard.
type Request ¶
type Request struct {
Verb string `json:"verb"`
Noun string `json:"noun"`
Target string `json:"target,omitempty"`
Args Arguments `json:"args,omitempty"`
Confirmed bool `json:"confirmed,omitempty"`
// Via is the alias the request was spelled by (an old verb name, a
// user's actions.json alias): the request is rewritten to the action it
// names (Noun, Verb) and Via keeps the spelling, so the handler is told
// which name ran it (Ctx.Invoked) and history shows it. "" for a
// request that named its action directly.
Via string `json:"via,omitempty"`
// Subjects are the instances a request acts on when it acts on
// several (the rows of a visual selection), in display order; Target
// is one of them, the one a confirm or a chooser names. Empty means
// Target alone. A verb that takes many subjects (Operation.Many) runs
// once with all of them in Ctx.Subjects; any other runs once per
// subject (Runtime.eachSubject).
Subjects []string `json:"subjects,omitempty"`
// Prop, Value and Toggle make the request prop-shaped (props.go):
// {noun, prop} reads the prop of the thing the request acts for,
// {noun, prop, value} writes it and {noun, prop, toggle} flips a
// boolean prop. A prop-shaped request names no verb; it runs as the
// noun's standard get or set (propVerbRequest), and history keeps it
// as it was sent. Args then holds at most the subject's key.
Prop string `json:"prop,omitempty"`
Value any `json:"value,omitempty"`
Toggle bool `json:"toggle,omitempty"`
}
Request names an operation and, optionally, the instance it addresses. Confirmed skips the operation's Confirm prompt: the confirm modal's y sets it on the stored request, and a script may set it to run unattended.
func PropShorthand ¶ added in v0.53.0
PropShorthand is the request NOUN PROP [VALUE] runs (plan 2.6): a prop-shaped request, so it reads (no value), writes (a value) or flips a boolean (toggle) the thing it acts for, as the noun's standard get or set; args hold at most the subject's key (--KEY).
func (Request) Empty ¶ added in v0.53.0
Empty reports whether the request names nothing: no verb and no prop (a binding row's null request, an unbind).
func (Request) IsProp ¶ added in v0.53.0
IsProp reports whether the request is prop-shaped: it reads or writes a prop instead of naming a verb.
type Response ¶
type Response struct {
// Result is the operation's result. From HandleCall it is detached
// from application state: Lines stays Lines (each line encoded), any
// other value is its JSON encoding as a json.RawMessage, so object
// keys keep the order the handler's value marshals in (a struct's
// field order); a nil or null result is nil.
Result any `json:"result,omitempty"`
Error string `json:"error,omitempty"`
// Argument is true when Error is an ArgumentError: the request was
// refused for its arguments, before any instance was chosen.
Argument bool `json:"argument,omitempty"`
// Messages are what the call told the user while it ran (ctx.Notify,
// ctx.ClearNotice, ctx.Status), in order; the runtime's sink got them
// too. Messages posted later, by a job's Then, reach only the sink.
Messages []UIMessage `json:"messages,omitempty"`
}
Response is the reply to a socket call: a result or an error message.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is what an application handler returns.
func Foreground ¶ added in v0.43.0
Foreground is the Result that runs cmd in the foreground (see above). Its stdio left nil is the terminal's; Then and Label work as on Pending. The completion's value is a ForegroundExit.
func Pending ¶
Pending schedules work off the loop as a job that accumulates: it runs beside the owner's other jobs and its completion is delivered whenever it finishes. The context is cancelled when the owning instance closes.
func (Result) Label ¶ added in v0.2.0
Label names this job for people reading the jobs list: the ticker shows it after the verb ("agent.launch claude running") and jobs.list carries it. It says which of a verb's jobs this is (the program a launch starts, the file a build writes); "" leaves the verb alone.
func (Result) Replacing ¶
Replacing puts the pending work in a slot on its owner: starting it cancels the owner's running job in the same slot, and a newer job in the slot cancels this one. Use it for replaceable work such as a preview or a search, never for independent work.
func (Result) ReplacingAt ¶
ReplacingAt is Replacing with the slot scoped to scope, the owner or one of its ancestors: the newest job in (scope, slot) cancels the older one whichever descendant of scope asked, so previews launched from the rows of one list replace each other while another list keeps its own. The job still belongs to the row that asked (its completion and Then land there and closing it cancels the job); Replacing(slot) is ReplacingAt(owner, slot). A scope off the owner's ancestry fails the launch.
type Runtime ¶
type Runtime struct {
Nouns map[string]*Noun
Instances map[string]*Instance
Focus string // the focused instance; Context() is derived from it
Mode ModeState // the one interaction mode; mode.set writes it, a focus change to another stop resets it
Page string // the current page instance; always an ancestor of BaseFocus()
Modes map[string]bool
Operations map[string]Operation
Quit bool
Pending string
// BindingTimeout, when positive, is how long every pending key
// sequence waits on this runtime in place of the sequence-timeout
// setting (a host or test that fixes it in code); 0, the default,
// reads the setting.
BindingTimeout time.Duration
// ResolveTarget, when set, maps a request target that is not an
// instance (a foreign id: an extension's row id, a database key) to
// the instance that stands for it; ExecuteAt consults it (TargetInstance)
// before refusing an unknown target, so keys, the palette, the CLI and
// the API all accept the foreign id. An error refuses the request with
// it; "" and no error leaves the target unknown.
ResolveTarget func(target string) (string, error)
// contains filtered or unexported fields
}
Runtime is owned by one event loop. Transport callers submit messages to that loop. It holds the operation registry (Operations, Modes and their guards), the instance registry (Nouns, Instances and their parent links, including list rows), the three plain interaction fields Focus, Mode and Page with the chain of open modals, the pending key-sequence state (Pending, prefix, BindingTimeout) and the hook that hands off-loop work to the adapter (commands). Components such as inputs, lists, the picker and the registers are instances, never fields; TestRuntimeHoldsNoComponentFields pins this list.
func NewRuntime ¶
func NewRuntime() *Runtime
NewRuntime returns a runtime with the framework nouns registered and focus on the app instance.
func (*Runtime) ActionAlias ¶ added in v0.28.0
func (r *Runtime) ActionAlias(name string) (ActionAlias, bool)
ActionAlias is the alias a name is, its noun resolved, or the bare alias a word without a dot is (false when the name is no alias).
func (*Runtime) ActionAliasProblems ¶ added in v0.28.0
ActionAliasProblems are the aliases dropped because an action registered under their name after them.
func (*Runtime) ActionAliases ¶ added in v0.28.0
func (r *Runtime) ActionAliases() []ActionAlias
ActionAliases lists every alias, sorted by name.
func (*Runtime) ActionFor ¶
ActionFor returns the innermost noun handler for an operation key on the focus stack, or nil when the operation's own Run applies.
func (*Runtime) AddActionAlias ¶ added in v0.28.0
func (r *Runtime) AddActionAlias(a ActionAlias) error
AddActionAlias registers an alias. The alias names a registered noun and a verb (dirs.base.add: the longest registered noun prefix is the noun, the rest the verb); action names a registered action, by its key or by another alias (which resolves to its action). An alias may not be the name of a registered action, nor of another alias for a different action; registering the same alias for the same action again is a no-op. Source defaults to app, or framework inside Builtin.
func (*Runtime) AddDetail ¶ added in v0.2.0
AddDetail registers a detail instance under its parent (Parent(page) or an instance beneath the page) and returns its component. item names what the detail shows now (the selected row's id); a different answer than the last one starts the detail at the top. A nil item never resets.
func (*Runtime) AddInput ¶
func (r *Runtime) AddInput(in *Input, opts ...InstanceOption) error
AddInput registers an editor instance. Options: Parent(id) (default app), Kind(noun) (default "editor"; "prompt" pins insert mode) and Completions(triggers...).
func (*Runtime) AddList ¶
AddList registers a list instance of the list noun with its rows. Options: Parent(id) (default app), Kind(noun) for a list that answers to its own noun as well, NoSpill() for a list whose motions stay inside it, SpillToSelection() for one a spill lands in on its selected row, NoMarks() for a read-only view, ClearFilterOnEnter() for a list whose filter enter chooses a row and clears, Columns(...) for a table, and CellSelect() for a table with a current column (table_cells.go).
func (*Runtime) AddNounAlias ¶ added in v0.57.0
AddNounAlias registers a noun alias with its fields: Since and RemoveAfter (either) make it a deprecated name, accepted for now with a one-time notice naming the noun (and a bindings check note for a row spelled by it), but never completed, listed in the CLI's help or drawn (DisplayNoun). Note is free text added to the notice. Shadowed is ignored. Registering the same alias again replaces its fields.
func (*Runtime) AddPage ¶
func (r *Runtime) AddPage(id, title string, render func(*Runtime, int, int) Block, opts ...InstanceOption) (*Page, error)
AddPage registers a page instance of kind page under app with a title and a renderer. Options: Focus(id) names where the page starts (the page itself or an instance beneath it, registered first) and Kind(noun) a noun of the application's own. Registration does not activate the page; see OpenPage. It is RegisterPage for callers that do not hold a *Page.
func (*Runtime) AddPathSource ¶ added in v0.44.0
func (r *Runtime) AddPathSource(name string, fn func(PathPick) (ChooserSource, bool))
AddPathSource adds a source to every path chooser, after browse, recent and typed, in the order added; adding a name again replaces it. fn builds the source for one open (false leaves it out of that one). A row's Data is the path a pick takes (a string).
func (*Runtime) AddRecordEditor ¶ added in v0.2.0
func (r *Runtime) AddRecordEditor(id string, spec RecordSpec, opts ...InstanceOption) (*RecordEditor, error)
AddRecordEditor places a record editor under Parent (default app); the application draws it with Block in its page. FocusOnClose names where the focus goes when it leaves. Call Focus to start editing.
func (*Runtime) AddSegment ¶ added in v0.36.0
AddSegment adds status segments. A row whose id is already registered changes that segment: its non-zero fields replace the old ones, and a row naming a source replaces the old source, so an application turns a library row on with AddSegment(Segment{ID: "cpu", Enabled: On(true)}). Each segment's setting (SegmentSetting) is declared with the row's Enabled as its default.
func (*Runtime) AddSettingsPage ¶ added in v0.7.0
AddSettingsPage registers the Settings page as a permanent page, a tab in registration order like the application's own; settings.edit then switches to it and settings.close goes back without removing it. Without it, settings.edit registers the page when it opens and settings.close removes it.
func (*Runtime) AddTerminal ¶
func (r *Runtime) AddTerminal(id string, stream TerminalStream, opts ...InstanceOption) (*Terminal, error)
AddTerminal registers a terminal instance of the terminal noun fed by stream, in terminal mode: every key forwards to the pane except the leader. Options: Parent(id) (default app), Kind(noun) for a noun that supplies its own tables and CloseOnDetach to remove the instance (and release the stream) on detach. The first frame read is scheduled at once.
func (*Runtime) AddTimeline ¶ added in v0.17.0
AddTimeline registers a timeline under Parent (default app) with its cards. Options: FollowTail, HeaderLines(n), NoSpill (motions stay in it), ParentStop(id) (where h on a closed card goes).
func (*Runtime) AddTree ¶
AddTree registers a tree under Parent (default app) with its nodes. Columns(...) makes its rows a table; NoSpill keeps motions inside it; NoMarks makes it a read-only view whose rows take no marks; ClearFilterOnEnter makes enter in its filter line choose the match and clear the filter.
func (*Runtime) AddVerbAvailability ¶ added in v0.55.0
AddVerbAvailability adds a guard to a registered verb (aliases resolve) beside the availability it already has (its own guard, NounBuilder.When or SetAvailability, and guards added before): the verb is available only while every one holds, so the resolver, the palette, the hints, the help and Execute all leave it out where the added guard is false. It is how an application narrows a framework verb it uses (ochazuke.list.choose-column where its own pane draws no columns) without replacing the framework's guard or guarding each binding row. The guard need not be registered yet; one that is not registered when asked hides nothing, as a verb guard does. Adding a guard the verb already has is a no-op.
func (*Runtime) AddVerbCheck ¶ added in v0.43.0
AddVerbCheck hangs a check on the verb key names (aliases resolve). A check of the same name on that verb is replaced in place.
func (*Runtime) Alias ¶ added in v0.16.0
Alias makes alias another name of noun: input naming alias (keys, binding files, actions.json, the palette, the CLI, Do) reaches noun unless the application registers a noun named alias, which then owns the name. The framework registers one per framework noun (settings for ochazuke.settings); a host mounting an extension's nouns under a namespace (json.doc) gives each its bare name (doc) the same way. An alias holding a dot is refused, as is one that already names another noun (Unalias it first). See AddNounAlias for a deprecated alias.
func (*Runtime) AliasAction ¶ added in v0.28.0
AliasAction makes alias another name of the action registered as action (an application's permanent alias: show for get, forget for kill, or the same operation under another noun, project.associate for pane.associate). See AddActionAlias for the rules.
func (*Runtime) AliasOf ¶ added in v0.16.0
AliasOf is the alias DisplayNoun draws noun by ("" when it draws the noun itself): under nouns.display shortest (the default) the shortest live alias that reaches noun now and is shorter than its name; under framework only a framework noun's short name (settings for ochazuke.settings); under canonical none.
func (*Runtime) AliasShadow ¶ added in v0.43.0
AliasShadow is the aliases.shadow setting's value (refuse unless set to allow).
func (*Runtime) Aliases ¶ added in v0.16.0
Aliases lists the alias names, each with the noun it names, sorted by alias; a deprecated alias carries its Since, RemoveAfter and Note.
func (*Runtime) AliasesOf ¶ added in v0.28.0
func (r *Runtime) AliasesOf(name string) []ActionAlias
AliasesOf lists the aliases of an action (by its key or any of its names), sorted by name; nil when it has none.
func (*Runtime) Ancestry ¶
Ancestry walks the parent links from id outward: id first, app last. An unknown id yields nil.
func (*Runtime) Available ¶ added in v0.36.0
Available reports whether an action can run now: its availability (the verb guard, NounBuilder.When or SetAvailability) holds at the focus in the mode for the request's arguments, or it has none. The guard reads a KeyEvent whose Focus and Level are focus, Mode is mode and Args are the request's (a binding row's own arguments, or a CLI call's), so an action that acts on an argument (timeline.open {card}) judges that thing. The resolver runs, at each level, the first row on a key whose action is available (an unavailable one stands aside and the key goes on, out to the next level when none at this one is); the palette, the hints, the help and Execute ask the same question. A guard name that is not registered hides nothing. A standard verb also reads its props' guards (PropSpec.When, propsAvailable), and a prop-shaped request is asked as the get or set it runs as.
func (*Runtime) BaseFocus ¶
BaseFocus is the focus beneath every open modal: the return of the outermost modal, else Focus. Runtime.Page is always an ancestor of it.
func (*Runtime) BaseMode ¶
BaseMode is the mode Runtime.Mode stands in: its name, or for a pending mode or a key-sequence prefix the base mode it returns to.
func (*Runtime) BeforeQuit ¶ added in v0.43.0
BeforeQuit hangs a check named name on app.quit: return AskFirst(prompt) while there is something to lose (unsaved edits), Refuse(reason) when quitting must not happen now, else Allow(). app.quit {force: true} skips it.
func (*Runtime) Bind ¶
Bind installs rows from config or code onto their noun or instance tables by identity (mode, keys or pattern, and When): the row with the same identity is replaced in place, a new row is added (a guarded one before the unguarded row on its keys, so it answers first while its guard holds), and an unbind row removes only the row with its identity. A key sequence in progress (d of d d) is kept unless a row added or removed is on it: in its mode, with the keys typed so far, a sequence extending them or one they extend. Such a row cancels the sequence, so the next key starts fresh against the new tables.
The rows of one call are one batch (rowBatch): a key repeated with the same identity is not a replacement but an alternative after the first, so Bind(Do("timeline.open"), Do("timeline.enter")) on l keeps both, and the first whose action is available answers.
func (*Runtime) BindingDebts ¶ added in v0.36.0
BindingDebts lists the stored rows that carry a guard of their own (Binding.When; the editor's implicit input guard aside): the older way to say when a key answers, kept working while areas move the condition onto the action's availability (Available), so the row needs none.
func (*Runtime) BindingTimeoutCommand ¶
BindingTimeoutCommand schedules the latest deadline once. Custom Tea models call it after dispatch and send BindingTimeoutMsg to HandleBindingTimeout. A prefix without a deadline (sequence-timeout 0, the default) schedules nothing.
func (*Runtime) BindingTimeoutTick ¶ added in v0.16.0
func (r *Runtime) BindingTimeoutTick() (BindingTimeoutMsg, bool)
BindingTimeoutTick is the sequence timer in flight as the message its command delivers at the deadline, already due: a host with a fake clock (explore) delivers it at once instead of waiting sequence-timeout, as Model.JobLingerTick does for the linger timer. False when no sequence waits on a deadline (none pending, or sequence-timeout 0).
func (*Runtime) BindingsDoc ¶ added in v0.33.0
func (r *Runtime) BindingsDoc() BindingsDoc
BindingsDoc is every stored table as a bindings file: the pending and passthrough modes, every noun's mode tables (with their extends) and every instance's, in GroupBindings order, rows in table order.
func (*Runtime) Builtin ¶ added in v0.8.0
func (r *Runtime) Builtin(register func())
Builtin runs register and marks every operation it registered as the framework's own (Operation.Builtin). NewRuntime and NewModel wrap their registrations in it, and so does every framework constructor that registers operations after them (NewPicker, NewPalette, NewAppearance, grid.Register, markdown.Register, cli.AddCommands), so an operation registered lazily is marked too. Operations registered before it, or by the application at any other time, keep Builtin false. Calls nest. It is for framework packages; an application's own verbs are not builtin.
func (*Runtime) CancelPendingBinding ¶
func (r *Runtime) CancelPendingBinding()
CancelPendingBinding leaves a key-sequence prefix mode without running its completed match and invalidates its timer.
func (*Runtime) CanonicalKey ¶ added in v0.16.0
CanonicalKey is an operation key with its noun resolved (CanonicalNoun): settings.set is ochazuke.settings.set unless the application has a settings noun of its own. A name is looked up whole first: a registered action or action alias keeps its name, and a dotted verb (dirs.base.add) resolves where it was declared; otherwise each dot, last first, is tried as the noun/verb split, and an unknown name reads its last dot (SplitKey).
func (*Runtime) CanonicalNoun ¶ added in v0.16.0
CanonicalNoun is the registered noun a noun name stands for. A noun the application registered under that exact name owns it (an app's own settings noun shadows the framework's alias); otherwise an alias (settings for ochazuke.settings) names its noun; otherwise the name is returned unchanged. While framework code registers (Runtime.Builtin) an alias wins over an application noun of the same name, so the framework's rows and tables always reach its own nouns. The v0.16.0 spelling app.<noun> of a framework noun is read as ochazuke.<noun> (deprecated, for one release) unless a noun of that exact name exists or the app noun has a verb of that name (app.state, an application verb, shadows the old spelling of ochazuke.state).
func (*Runtime) CanonicalRequest ¶ added in v0.28.0
CanonicalRequest is q as the runtime runs it: its noun resolved and an alias rewritten to its action, Via keeping the alias (a host building a request from words, the CLI shell, calls it before reading the operation by q.Key()).
func (*Runtime) CaseFor ¶ added in v0.55.0
CaseFor is the CaseMatch the search.case setting gives query.
func (*Runtime) Changed ¶ added in v0.53.0
Changed tells the watches of nouns (every watch when none is named) that their things may have changed: each fallback watch lists again and emits the difference. An application calls it when its store changed other than through a verb of the change kind (an editor's write, a daemon's event delivered on the loop). Call it on the loop.
func (*Runtime) CheckDefaultBindings ¶ added in v0.34.0
CheckDefaultBindings reports what is wrong with a default bindings file on this runtime, every problem at once: a file that does not parse, a table whose noun, instance or mode is unknown, an extends to an unknown mode, a row that does not validate (an unknown operation, argument, source or guard), a mode.enter into a mode that is not pending, and two rows that clash (the same key and guard in one table: the second would replace the first). It is the rule check for embedded defaults: an application runs it in a test on its built runtime, after its files loaded, for each file it embeds.
func (*Runtime) CheckUserActions ¶ added in v0.28.0
CheckUserActions reports what a load of actions.json would skip, without installing anything: entries that do not parse or validate, and alias rows that clash with an action or another alias. An entry the last load installed unchanged is not a problem.
func (*Runtime) CheckUserBindings ¶ added in v0.2.0
CheckUserBindings reports what a load of the bindings file would skip, without installing anything, and any row of the merged tables that no longer validates; then warnings ("warning: " lines): each guard row of the file (a debt, BindingDebts) and each merged row that can never answer (UnreachableBindings). A row spelled by an action alias is accepted and gets a line saying what it resolves to (not "skipped"). The problems of actions.json (CheckUserActions) follow.
func (*Runtime) Choices ¶
Choices lists a parameter's accepted values in context c: its Enum, then the result of its choices source (ChoicesSource), or, for a Noun with no list verb, the noun's live instances. A source that asks for confirmation is refused; it must be a read.
func (*Runtime) ChoicesFor ¶ added in v0.44.0
ChoicesFor is Choices for the text typed so far: a source that declares ChoicesQueryParameter receives query.
func (*Runtime) ChoicesSource ¶ added in v0.14.0
ChoicesSource is the operation (noun.verb) a parameter's choices come from: its Source, else its Noun's list verb when that is registered, asks for no confirmation and needs no argument; empty when there is none (a Noun parameter then lists the noun's live instances).
func (*Runtime) ChoicesTakeQuery ¶ added in v0.44.0
ChoicesTakeQuery reports whether a parameter's choices source sees the typed text (it declares ChoicesQueryParameter).
func (*Runtime) Chooser ¶ added in v0.2.0
Chooser is the open chooser of kind, nil when none is open.
func (*Runtime) ChooserLastSource ¶ added in v0.44.0
ChooserLastSource is the source last used by a chooser of kind ("" when none was).
func (*Runtime) ChooserMatch ¶ added in v0.59.0
ChooserMatch is the chooser.match setting (fuzzy for any other value and on a nil runtime).
func (*Runtime) ChromeLevel ¶ added in v0.59.0
ChromeLevel is the chrome.color value, rich (its default) when it holds anything else.
func (*Runtime) CompletionTriggers ¶ added in v0.5.0
func (r *Runtime) CompletionTriggers(id string) []CompletionTrigger
CompletionTriggers are the triggers an input completes with: its own, else its noun's.
func (*Runtime) DeclareSetting ¶ added in v0.2.0
DeclareSetting declares settings; each must have a unique name, a known type and a default of that type (in the enum when there is one).
func (*Runtime) DeclareSettingOwner ¶ added in v0.55.0
func (r *Runtime) DeclareSettingOwner(owners ...SettingOwner) error
DeclareSettingOwner declares owners of settings (tabs of the Settings page). Declaring an ID again replaces its title, description and order where it stands.
func (*Runtime) DeclareSettingSection ¶ added in v0.55.0
func (r *Runtime) DeclareSettingSection(sections ...SettingSection) error
DeclareSettingSection declares sections of an owner's settings (rows of the Settings page's section list). Declaring an owner's section again replaces its title and description where it stands.
func (*Runtime) DefaultBindings ¶ added in v0.34.0
func (r *Runtime) DefaultBindings() []DefaultBinding
DefaultBindings are the rows of the default layer, every table as it stands without the user's bindings.json (the rows it replaced back in place, the rows it added left out), each with its source: nouns by name, each noun's modes by name, then instances by id, rows in table order.
func (*Runtime) DefaultBindingsDoc ¶ added in v0.51.0
func (r *Runtime) DefaultBindingsDoc() BindingsDoc
DefaultBindingsDoc is BindingsDoc without the user's bindings.json: every table as it stands with the rows the file replaced or unbound back in place and the rows it added left out (DefaultBindings, which replays the applied rows backwards on a copy). With no user file it equals BindingsDoc. The generated reference is drawn from it.
func (*Runtime) Define ¶
func (r *Runtime) Define(name string) *NounBuilder
Define declares a noun, or returns the builder of an existing one. A name the framework's nouns answer to (settings for ochazuke.settings: CanonicalNoun) returns that noun's builder, so an application's verbs and rows extend it; DefineOwn claims the short name for a noun of the application's own instead. Inside Builtin a plain name is the framework noun ochazuke.<name>.
func (*Runtime) DefineGuard ¶
DefineGuard registers a named row guard.
func (*Runtime) DefineMode ¶
func (r *Runtime) DefineMode(name string, pending bool, opts ...ModeOption) error
DefineMode registers a mode name. A pending mode is exclusive: only rows in its own table answer, and a row that leaves the mode unchanged returns the instance to the mode it shadowed.
func (*Runtime) DefineOwn ¶ added in v0.16.0
func (r *Runtime) DefineOwn(name string) *NounBuilder
DefineOwn declares a noun of the application's own under exactly name, or returns its builder when it exists. When name is the alias of a framework noun (settings for ochazuke.settings) the application's noun owns the short name from then on: keys, binding files, actions.json, the palette and the CLI reach it by that name, and the framework's noun stays reachable by its canonical name (ochazuke.settings), its verbs and rows intact. An application with a settings, config or page noun of its own declares it with DefineOwn instead of removing the framework's.
func (*Runtime) DefinePassthrough ¶
DefinePassthrough marks a defined mode as a passthrough mode: while it is the base mode (a pending mode over it included) capture rows stand aside, so the focused level's rows answer every key. The terminal mode is one: ctrl+c reaches the pane instead of the app's captured quit.
func (*Runtime) DefineSelection ¶ added in v0.43.0
DefineSelection marks a defined base mode as a selection mode of shape (char, line, block, or a component's own shape such as the grid's row and column); "" makes it an ordinary mode again.
func (*Runtime) Deliver ¶
Deliver routes a message on the loop: a Completion goes to its owner when its job is running and is dropped otherwise; any other message is offered to every component until one claims it. A Then callback that removes its own owner is safe: the job is already settled and the completion is not offered to the gone component. It reports whether a component consumed the message and the delivered completion's error, if any.
func (*Runtime) DeprecatedNounAlias ¶ added in v0.57.0
DeprecatedNounAlias is the deprecated alias name stands for, if it is one that reaches its noun now.
func (*Runtime) Dispatch ¶
Dispatch resolves one key through the stack walk and runs the first row that answers. It reports whether any row claimed the key. Live keys and macro playback both arrive here.
func (*Runtime) DispatchOutcome ¶ added in v0.36.0
func (r *Runtime) DispatchOutcome(key MacroKey) (KeyOutcome, error)
DispatchOutcome is Dispatch reporting which of the three outcomes the key had: handled, unhandled (no level had an available row on it), or consumed by a noop row.
func (*Runtime) DisplayKey ¶ added in v0.16.0
DisplayKey is an operation key with its noun as DisplayNoun.
func (*Runtime) DisplayNoun ¶ added in v0.16.0
DisplayNoun is the shortest name that reaches noun: its alias (AliasOf) while no application noun shadows it (list for ochazuke.list, doc for an extension's json.doc a host aliased doc), else noun itself. The footer's hints, the ? help, the palette and the jobs ticker draw it; history, bindings.list, operations.list and the catalog print canonical names.
func (*Runtime) DocsPage ¶ added in v0.51.0
DocsPage is a topic's page rendered from the live runtime with the running binary's stamp, and the viewer's header line naming that build: "TOOL COMMIT[+dirty] · VERSION · catalog FINGERPRINT". The page's text is its body below the generated header (the header line stands for it); with docs.show-config off it equals the committed file's body for the same catalog.
func (*Runtime) DocsTool ¶ added in v0.51.0
DocsTool is the tool name the docs viewer's header and pages name: the config's App, else the binary's name.
func (*Runtime) EnsureConfigSettings ¶ added in v0.2.0
func (r *Runtime) EnsureConfigSettings()
EnsureConfigSettings declares the framework settings whose rows depend on the application, unless the application declared one of the same name first: theme (the colour scheme; its choices are the built-in themes and themes.json's, read here and again when the config directory changed), pages.hidden (its default the pages declared hidden), the segments' settings and history-limit while the history is persisted. The fixed framework settings (settings/ochazuke.json) are declared when the runtime is made, so they need no call. It applies terminal-leader when an application declared it (EnsureTerminalLeader). Model.Init and the CLI shell call it, so settings set works in both; an application may call it earlier (after setting Config.App) to have them before the Model starts.
func (*Runtime) EnsureHistory ¶ added in v0.2.0
func (r *Runtime) EnsureHistory()
EnsureHistory persists the action history, once: it reads the history file (the last history-limit entries, marked Restored, before what this session already recorded), compacts it when it holds more or has lines that do not parse (each such file is one notice), and starts the writer every later entry is appended through. Nothing happens without a state directory (Config.Disable, a test binary) or with Config.NoHistoryFile. Model.Init calls it; the CLI shell does not (a one-shot call is not history worth keeping).
func (*Runtime) EnsureNounPlaces ¶ added in v0.15.0
func (r *Runtime) EnsureNounPlaces()
EnsureNounPlaces persists the placements record, once: it reads the placements file into the record (a file that does not parse is one notice and is replaced at the next write) and starts the writer the record is saved through, off the loop, at most every NounPlaceWriteEvery and on Config.Flush. Nothing is read or written without a state directory (Config.Disable, a test binary). Model.Init calls it.
func (*Runtime) EnsureSegments ¶ added in v0.36.0
EnsureSegments declares the segments area's settings and reads the user's segments.json, once. EnsureConfigSettings calls it (Model.Init and the CLI shell), so settings set reaches every segment.
func (*Runtime) EnsureTerminalLeader ¶ added in v0.2.0
func (r *Runtime) EnsureTerminalLeader()
EnsureTerminalLeader declares the terminal-leader setting unless the application declared it: an application with terminal panes calls it at setup (cli.AddCommands does), so settings.json, the Settings page and the CLI's settings set know the setting before the first pane opens. An application without terminals does not, and its settings list stays free of it. How long the leader waits is sequence-timeout, as for every other sequence.
func (*Runtime) EnsureUserActions ¶ added in v0.2.0
EnsureUserActions installs the user's actions.json once; later calls do nothing. Model.Init, cli.Mount and the CLI shell call it before the user bindings, so a bindings.json row can name an action's verb.
func (*Runtime) EnsureUserBindings ¶ added in v0.2.0
EnsureUserBindings applies the user bindings file once; later calls do nothing. Model.Init and the CLI shell call it, after the application defined its own rows, so a file row replaces an application default.
func (*Runtime) ExecuteAt ¶
ExecuteAt runs an operation for a context. The innermost noun on the focus stack that overrides the operation handles it; otherwise its Run does. Every request is appended to the action history with its kind, the context it ran in, its outcome and where it moved the interaction.
func (*Runtime) ExportConfig ¶ added in v0.6.0
func (r *Runtime) ExportConfig(dir string, force bool) (ConfigExport, error)
ExportConfig writes a complete reference of the user configuration into dir ("" is <config dir>/reference): settings.json with every declared setting at its current value, settings.reference.json with each setting's type, default, choices, description and value, and bindings.reference.json with every stored table in the grouped bindings format (FormatBindings of BindingsDoc), settings.reference.json and actions.example.json one row per line (FormatRows). Each file is written atomically, a temp file renamed over it. A file that would land on one of the live config files (dir is the config directory) is refused unless force is set, and then nothing is written.
func (*Runtime) FocusDisplay ¶ added in v0.20.0
FocusDisplay is the focus-display value, off when it is undeclared or holds anything else.
func (*Runtime) FocusInTopLevel ¶ added in v0.16.0
FocusInTopLevel reports the focus invariant: the focus is inside the top level, the top modal's subtree while a modal is open (else the current page, else app).
func (*Runtime) FocusNoun ¶ added in v0.20.0
FocusNoun is the focused instance's noun as DisplayNoun, "" without a focus.
func (*Runtime) FocusPath ¶ added in v0.20.0
FocusPath is the focus as the stack shows it, outermost level first and the focused instance last, app left out: each level's label when it has one no wider than FocusLabelMax (a page's is its title), else its noun as DisplayNoun. Open modals are levels in the chain: a modal's levels follow the focus it opened over.
func (*Runtime) GuardHolds ¶ added in v0.16.0
GuardHolds evaluates the named guard at focus in the current mode, as the footer's hints and ? help judge a row's guard (KeyEvent{Mode, Focus}); known is false for a name no guard answers to.
func (*Runtime) GuardNames ¶ added in v0.16.0
GuardNames lists every registered row guard (the built-ins and those of DefineGuard), sorted. The "op:<key>" family is not listed: it is a pattern, not a name.
func (*Runtime) HandleBinding ¶
HandleBinding dispatches a named key; kept for callers that only know keys.
func (*Runtime) HandleBindingTimeout ¶
func (r *Runtime) HandleBindingTimeout(msg BindingTimeoutMsg) (bool, error)
HandleBindingTimeout executes the longest completed match, or clears an incomplete prefix. Its result is false for a stale or cancelled timer.
func (*Runtime) HandleCall ¶
func (*Runtime) HelpModes ¶ added in v0.15.0
HelpModes are the modes the help's pick view offers for place's noun: the registered modes, and with pending the pending modes and every key-sequence prefix the place's walk binds ("normal g" after g). NounPlace{Noun: noun} is the noun with no place.
func (*Runtime) HelpTable ¶ added in v0.15.0
HelpTable is the help's table view for place's noun (NounPlace{Noun: noun} for no place): the modes whose own tables hold a row on its walk (the registered modes, and with pending the pending ones; a key sequence is a row of its base mode, so prefixes add no column), and a row per key or key class with its rows per mode (nounRows; a generated prefix cancel left out). The keys the noun or a level of its place answers come first, then app's, each sorted with key classes last.
func (*Runtime) HiddenPages ¶ added in v0.41.0
HiddenPages is the pages.hidden value: the ids left out of the tabs. Before the setting is declared (EnsureConfigSettings, Model.Init, or the first page.hide or page.show) it is the declared-hidden pages.
func (*Runtime) HidePage ¶ added in v0.41.0
HidePage adds a page to pages.hidden. It refuses an unknown page and the last page not hidden, so the tabs always hold one; hiding the current page keeps it open, its tab shown until another page opens.
func (*Runtime) History ¶
func (r *Runtime) History(n int) []HistoryEntry
History returns the last n entries of every kind, oldest first (all of them for n <= 0): the user's and the fetches, merged by Seq.
func (*Runtime) HistoryOf ¶ added in v0.7.0
func (r *Runtime) HistoryOf(n int, kinds ...string) []HistoryEntry
HistoryOf returns the last n entries of the given kinds (every kind when none is given), oldest first; n <= 0 returns all of them.
func (*Runtime) Instance ¶
func (r *Runtime) Instance(id string, opts ...InstanceOption) *Instance
Instance registers a plain instance: a page body, a panel, a modal body. Its noun is defined when it does not exist yet; a framework alias names the framework's noun (Kind("prompt") is ochazuke.prompt). Registering an existing id returns it unchanged.
func (*Runtime) InstancePath ¶
InstancePath is Ancestry reversed: app first, id last.
func (*Runtime) Invoked ¶ added in v0.28.0
func (r *Runtime) Invoked() Invocation
Invoked is the name the running request named its action by (the action's own key unless an alias ran it); the zero Invocation outside a request.
func (*Runtime) IsPassthrough ¶ added in v0.16.0
IsPassthrough reports whether name is a passthrough base mode (DefinePassthrough).
func (*Runtime) IsPendingMode ¶ added in v0.16.0
IsPendingMode reports whether name is a registered pending mode.
func (*Runtime) Issue ¶
Issue admits a job for owner and returns its ticket and the context its work runs under; the caller runs the work and reports back with a message carrying the ticket, checked with Accepts and closed with Settle. A slot name cancels the owner's running job in that slot; "" accumulates. Launch and Start build on it for work the runtime runs as a tea.Cmd.
func (*Runtime) IssueAt ¶
IssueAt is Issue with the slot scoped to scope, owner or one of its ancestors: the running job in (scope, slot) is cancelled whichever instance owns it. See Result.ReplacingAt.
func (*Runtime) Jobs ¶
Jobs lists every job the runtime knows in start order: the running ones and the finished ones retained since the last jobs.list read.
func (*Runtime) JumpFocus ¶
JumpFocus moves the focus steps stops (scope "stop") or regions (scope "region") forward, or backward for negative steps, through the focus root in drawing order (units), wrapping. The current unit is the nearest stop (or region) on the focus path; the next one is the first after that unit's whole subtree. A stop is never descended into (a grid is one stop, its cells are not); the focus lands on the unit's remembered child.
func (*Runtime) KeyEcho ¶ added in v0.55.0
KeyEcho is the keys.echo value, off when it is undeclared or holds anything else.
func (*Runtime) Launch ¶
Launch starts a pending result as a job of owner under verb and queues its work for the adapter. The completion reaches the owner's Component.HandleMessage and the result's Then callback when the job is still current.
func (*Runtime) ListBindings ¶
ListBindings prints the rows the focus answers to in its current mode, one per key or pattern, sorted by key with pattern rows last.
func (*Runtime) LoadBindings ¶
LoadBindings installs rows from a JSON array in the binding row shape and returns the installed rows.
func (*Runtime) LoadDefaultBindings ¶ added in v0.34.0
LoadDefaultBindings installs a default bindings file (the grouped format, ParseBindings in bindings_file.go) into the default layer: the noun and instance tables, below the user's bindings.json, exactly where the same rows bound in Go would sit. Modes come first, then each group's rows in file order (a row replaces the row with its identity in place, a guarded row goes before the unguarded row on its keys, a sequence gets its prefix cancel), then the group's extends.
Unlike a user file, an embedded default is checked strictly: an unknown operation, argument, source, guard, mode or instance is an error naming source, the table and the key, and the rows after it are not installed. An application loads its files at setup, after it registered the verbs and guards they name and before Model.Init applies the user's file; MustLoadDefaultBindings panics instead, so a test that builds the app catches a bad row. source tags the rows in bindings defaults ("mtm/ bindings/app.json").
func (*Runtime) LoadDefaultBindingsFS ¶ added in v0.34.0
LoadDefaultBindingsFS installs every file of fsys matching the patterns (fs.Glob), each pattern's files in name order, each tagged with its path. A pattern that matches nothing is an error.
func (*Runtime) Matcher ¶ added in v0.59.0
Matcher compiles query in mode with case as search.case says.
func (*Runtime) ModalFocus ¶
ModalFocus is the instance an open modal points at: Focus for the top modal, else the return focus stored in the modal opened over it.
func (*Runtime) ModalReturn ¶ added in v0.16.0
ModalReturn is what closing an open modal restores: the focus and mode it opened over. Unknown or closed modals report "" and the zero mode.
func (*Runtime) ModeBadgeKeyCase ¶ added in v0.53.0
ModeBadgeKeyCase is the mode-badge.key-case value, upper when it is undeclared or holds anything else.
func (*Runtime) ModeBadgeWidth ¶ added in v0.55.0
ModeBadgeWidth is the cells the mode badge's label reserves (Header.BadgeWidth): with mode-badge.width widest (the default, or any value it does not know), the widest label of a registered base mode (Runtime.Modes, as the badge names it); 0 with fit. Pending modes are left out: they show the keys they hold, so no width fits them, and a longer label grows the badge leftward from the same right edge.
func (*Runtime) ModeKnown ¶ added in v0.16.0
ModeKnown reports whether the current mode is one the runtime defined: a base mode, a pending mode, or a key-sequence prefix over a base mode.
func (*Runtime) ModeParent ¶ added in v0.43.0
ModeParent is the mode name falls back to for a noun with no table of its own (ModeExtends), "" for none.
func (*Runtime) MustLoadDefaultBindings ¶ added in v0.34.0
MustLoadDefaultBindings is LoadDefaultBindings that panics on an error: embedded defaults are code, and a bad row fails at startup.
func (*Runtime) NoteNounAlias ¶ added in v0.57.0
NoteNounAlias posts the one-time notice of a deprecated noun alias typed as name (a request's noun, a palette or CLI word); nothing for any other name.
func (*Runtime) Noun ¶
Noun returns the registered noun a name stands for (an alias resolved: CanonicalNoun), or nil.
func (*Runtime) NounAliasNotice ¶ added in v0.57.0
NounAliasNotice is the one-time notice of name when it is a deprecated noun alias whose notice has not been given yet in this runtime, and records it as given; ok is false otherwise. NoteNounAlias posts it; a host printing its own warnings (cli.Mount) takes the text.
func (*Runtime) NounAliasesOf ¶ added in v0.57.0
NounAliasesOf lists the aliases that reach noun now (not shadowed by an application noun of their name), the live ones shortest first, then the deprecated ones.
func (*Runtime) NounPlaces ¶ added in v0.15.0
NounPlaces is where noun was seen (every noun when noun is ""): one entry per distinct place, most seen first, then most recently seen. It includes the placements file's when the Model read it (EnsureNounPlaces). A consumer resolving a key for a noun that is not on the focus path walks a placement's Chain (outermost first) from its Page, or from its Modal.
func (*Runtime) NounWords ¶ added in v0.16.0
NounWords reads the noun a command line's leading words name and returns it (canonical) with the words after it. The noun is the longest run of leading words that, joined with dots, names a noun or an alias of one: "ochazuke settings list" and "ochazuke.settings list" are ochazuke.settings, "settings list" is ochazuke.settings unless the application has a settings noun of its own, "app quit" is app. At least one word is left for the verb. ok is false when no leading run names a noun.
func (*Runtime) OnConfigReload ¶ added in v0.15.0
OnConfigReload adds an application's own configuration to config.reload: fn reads its file again and returns the problems it found (an entry skipped, a file that does not parse), never fatal. Hooks run in registration order after the framework's files. Each problem not already starting with "name: " gets that prefix, is reported through Config.Report like a framework file's and withdrawn at the next config.reload. fn runs on the update loop.
func (*Runtime) OpenArgsForm ¶ added in v0.36.0
OpenArgsForm opens the args form over the focus for a request whose verb lacks arguments: one field per parameter (ArgsFields), prefilled from q's arguments, the first missing required one focused (typing, when it is a text field). Every field is filled by the user: nothing is read from the focus or a guess (R12.5), except what a parameter declares and the form shows: a Focus parameter starts holding the focused thing (focusValue), and an Edits one the subject's current value of its prop, selected as a rename is, or empty with the prop's Fallback as its placeholder (argsFormStart). enter runs the form once every required field is valid (form.run) and otherwise goes to the field that still needs a value; esc in normal mode cancels and runs nothing. run executes the completed request after the form closed, at the focus it opened over; its error reopens the form with the values. When the only missing required parameter is a path and SinglePathSetting allows, no form opens: the path chooser does (the editor returned is nil), and its pick runs the request.
func (*Runtime) OpenChooser ¶ added in v0.2.0
func (r *Runtime) OpenChooser(spec ChooserSpec) (*Chooser, error)
OpenChooser opens a chooser modal with its search input focused in insert mode. Like OpenModal, it opens only from the top level.
func (*Runtime) OpenModal ¶
OpenModal opens a modal whose body is a new instance of noun kind (its id is the kind), parented at the current focus and carrying payload, and focuses it (or the input WithInput places in it). The instance lives until Pop closes the modal. The kind's rows answer first, then the focus it opened over, then the modal noun.
func (*Runtime) OpenPage ¶
OpenPage makes a page current and restores the focus and mode it was left in; an open modal blocks navigation. Runtime.Page is always an ancestor of the focus.
func (*Runtime) OpenPagePicker ¶ added in v0.2.0
OpenPagePicker opens the page chooser (page.pick): the pages visited before, most recent first, then the pages never visited in registration order, then the current page, marked "current" (a hidden page is listed too, marked "hidden"), so the highlighted first row is the page last left and enter goes back to it. Typing filters by title; enter opens the highlighted page, esc closes.
func (*Runtime) OpenPathChooser ¶ added in v0.44.0
func (r *Runtime) OpenPathChooser(spec PathChooserSpec) (*Chooser, error)
OpenPathChooser opens the path chooser (browse, recent, typed, then the application's sources) for spec.Pick.
func (*Runtime) OpenRecordEditor ¶ added in v0.2.0
func (r *Runtime) OpenRecordEditor(id string, spec RecordSpec) (*RecordEditor, error)
OpenRecordEditor opens a record editor as a modal over the focus, its first field focused; leaving closes the modal and restores the focus and mode it opened over.
func (*Runtime) OpenTextView ¶ added in v0.55.0
OpenTextView opens text in the text view: a modal over the focus holding a read-only input (Input.ReadOnly), one line when the text is one line, else many, with the cursor at the start in normal mode. The editor's motions, visual modes and yanks work there; q or esc closes it back to the focus it opened over. title heads it (the palette's is the verb's name). Opened while the text view is the top modal, it shows the new text in its place, from the top, over the focus the first opened over (ReplaceOpen, R4.8).
func (*Runtime) OpenVisibleStart ¶ added in v0.41.0
OpenVisibleStart leaves a hidden start page: when the current page is hidden and another page is not, it opens the first page not hidden. Model.Init calls it once the settings are read, so an application whose start page the user hid opens on the first page in the tabs instead; later, opening a hidden page (page.open, OpenPage) stays on it.
func (*Runtime) Operation ¶ added in v0.16.0
Operation is the registered operation a key names, aliases resolved: noun aliases (settings.set) and action aliases (an old verb name) alike.
func (*Runtime) PageFocus ¶
PageFocus is the focus a page shows: the live base focus while it is the current page, else the focus it remembers.
func (*Runtime) PageHidden ¶ added in v0.41.0
PageHidden reports whether pages.hidden holds the page id.
func (*Runtime) PageList ¶
PageList lists pages in registration order: app's children of kind page. It reads the app instance's page order (appPages), so a frame that asks several times costs the number of pages, not of instances; without one (an application gave app a component of its own) it scans the instances.
func (*Runtime) PaneLayout ¶ added in v0.4.0
PaneLayout is l with the divider of the page id is on (or is): a page renderer that draws a list/detail split passes its Layout through it, so Split, SplitBlock, SplitFocusBlock and Divide follow the page's pane keys. Called while the page renders, it also records that the page draws a split, which is when pane.grow, pane.shrink and pane.reset answer their keys and show in the hints.
func (*Runtime) PaneShift ¶ added in v0.4.0
PaneShift is the remembered divider of page (Layout.Shift), 0 for the split's default.
func (*Runtime) PathStart ¶ added in v0.44.0
PathStart is the folder browse starts in for pick: the field's value's folder (the value itself for a folder; a relative value is under Base), else the parameter's Base, else what path.start names. It reads no file system.
func (*Runtime) PendingCommands ¶
PendingCommands drains the work scheduled since the last call: the runtime's own queue and every component's PendingCommand.
func (*Runtime) PendingModes ¶ added in v0.16.0
PendingModes lists the registered pending modes (DefineMode with pending), sorted.
func (*Runtime) Placed ¶
Placed records that the instance id is being drawn now, during its page's render: the order of these calls in a frame is the page's drawing order, which focus jumps (focus.next, focus.previous) and list spills walk, so motions follow the screen as drawn and cannot drift from it. List, Input (InputBlock), Terminal and grid views call it; a component of the application's own calls it from its view. Outside a page render it does nothing. There is no other way to order stops: before the first frame the order is the tree's, and once a frame drew any stop, a stop the last frame did not draw is skipped (it is not on screen). A stop drawn by an application view that never calls Placed is therefore skipped too.
func (*Runtime) PlacedAt ¶
PlacedAt records where the view text of instance id holds the focus (lines focus to focus+height of text; a list's selected row, an input's whole box) and returns text marked so its page finds the body line it lands on, which is how the page scrolls to keep the focus visible. Call it with the view's final text after Placed; it amends that placement (or places id, if Placed was not called). Outside a page render it returns text unchanged. List, Input, Terminal and grid views call it.
func (*Runtime) Pop ¶
Pop closes the active modal and restores the focus and mode it opened over. A body the modal created is closed through the delivery contract and removed with what it holds.
func (*Runtime) PropGuard ¶ added in v0.53.0
PropGuard is the guard a noun's prop is available under (PropSpec.When), "" for none: the prop guards, apart from the verb guards (VerbGuard).
func (*Runtime) Props ¶ added in v0.52.0
Props lists a noun's props in declaration order (a copy), nil for an unknown noun or one without props.
func (*Runtime) Push ¶
Push opens a modal with id focused on focus (app when empty). An id that is not already an instance becomes one of the modal noun for as long as it is open. The modal remembers the focus and mode it opened over.
func (*Runtime) Query ¶
Query returns the instances matching every predicate, in tree order: app first, then depth-first with siblings in the order they were added. An unknown predicate matches nothing; instances.query reports it instead.
func (*Runtime) ReadBareAlias ¶ added in v0.50.0
func (r *Runtime) ReadBareAlias(c Context, words []string, nouns []string) (BareReading, bool, error)
ReadBareAlias reads words (a palette line's or the CLI's) that start with a bare alias; false when the first word is none. nouns are the noun words that may follow a shadowing alias; nil reads every noun that has the verb. The CLI and the palette read a line with this one rule.
func (*Runtime) ReadNounWord ¶ added in v0.53.0
ReadNounWord reads the word after noun (owner decision 18): verbs are the noun's verb words where the line is read. An exact verb wins, then an exact prop, then a unique verb prefix, then a unique prop prefix.
func (*Runtime) ReadYank ¶
ReadYank reads a register ("" is the active register, else the unnamed one).
func (*Runtime) RecentPaths ¶ added in v0.44.0
RecentPaths are the paths picked through a path chooser this run, newest first.
func (*Runtime) RecordEditor ¶ added in v0.2.0
func (r *Runtime) RecordEditor(id string) *RecordEditor
RecordEditor is the record editor with this id, or nil.
func (*Runtime) ReferenceModel ¶ added in v0.51.0
ReferenceModel is the runtime as the generated reference sees it: every declared setting (with the user's value where it differs from the default) and every default key row (DefaultBindingsDoc, with the user's bindings.json rows that change each table). refdoc.Render draws the pages from it; the committed docs/reference files are its render on the framework runtime, and docs.open renders it live.
func (*Runtime) Register ¶
Register adds an operation. An operation with App set is of kind application and its Run is the framework's dispatcher for it. Its noun may be dotted (ai.skills) and so may its verb (base.add): the key is a name in a flat table, looked up whole. A noun named by a framework alias (settings) is the noun it names (ochazuke.settings), as Define reads it; inside Builtin a plain noun is ochazuke.<noun>. A verb y on noun x beside a noun x.y is refused (checkOverlap).
func (*Runtime) RegisterPage ¶
func (r *Runtime) RegisterPage(page *Page, opts ...InstanceOption) error
RegisterPage registers a page as an instance of kind page under app (the instance may already exist, registered through Instance with the inputs and lists it holds). Focus names where the page starts: the page itself or an instance beneath it. Registration does not activate the page. A page declared hidden by default (Page.DefaultHidden, or the DefaultHidden option) joins the pages.hidden setting's default.
func (*Runtime) RegisterPredicate ¶
func (r *Runtime) RegisterPredicate(name string, fn PredicateFunc)
RegisterPredicate adds a named predicate an application's queries (and the CLI's instances.query) can use, such as marked.
func (*Runtime) ReloadConfig ¶ added in v0.15.0
ReloadConfig reads every configuration file the application uses again, in dependency order: themes.json (when it was read: the theme setting's choices are then current), settings.json (when settings are declared; observers see every value that changed, the Model's theme among them), actions.json (when it was installed), bindings.json (when it was applied, once: a row can name an action's verb), segments.json (when it was read), then each OnConfigReload hook. Each file's last problems are withdrawn and its new ones reported, so no stale notice survives; a bad file is skipped, never fatal. It returns the problems in that order, each naming its file, and an error only when the application has no config directory.
func (*Runtime) ReloadThemes ¶ added in v0.2.0
ReloadThemes reads themes.json again: the schemes that validate replace the user's, every problem is reported (and the last read's withdrawn), and the theme setting's choices follow when the framework declared it. A missing file is no schemes and no problem.
func (*Runtime) ReloadUserActions ¶ added in v0.2.0
ReloadUserActions removes the actions a previous load installed, then reads actions.json again and installs each valid entry as an application verb. An entry that does not validate (an unknown noun, a verb that exists, a bad template) is skipped and reported, never fatal; a file that does not parse installs nothing. A missing file is no actions and no problem. It returns the problems, each also sent to Config.Report.
func (*Runtime) ReloadUserBindings ¶ added in v0.2.0
ReloadUserBindings takes out the rows a previous load installed (the rows they replaced come back), then reads the bindings file again and installs its rows one by one: a row that does not validate is skipped and reported, never fatal, and a file that does not parse installs nothing. A missing file is no rows and no problem. It returns the problems, each also sent to Config.Report.
func (*Runtime) ReloadUserSegments ¶ added in v0.36.0
ReloadUserSegments reads segments.json again: the rows it held before are taken back (a user-only segment goes, a patched one keeps the application's row), then each valid row patches or adds its segment. A row that does not validate is skipped and reported; a missing file is no rows and no problem.
func (*Runtime) RemoveInstance ¶
RemoveInstance closes an instance and its descendants (components closed, jobs cancelled) and drops them. Every focus reference into the removed subtree (Focus, a page's remembered focus, an open modal's return) moves to the nearest surviving ancestor (the Focus itself to a removed instance's FocusOnClose target when that survives); an open modal inside the subtree is kept and reparented there. app cannot be removed.
func (*Runtime) RemoveVerbAvailability ¶ added in v0.55.0
RemoveVerbAvailability takes a guard AddVerbAvailability added off a verb; false when the verb had no such added guard (its own guard stays: SetAvailability changes that one).
func (*Runtime) RemoveVerbCheck ¶ added in v0.43.0
RemoveVerbCheck takes the check named name off the verb; false when it had none of that name.
func (*Runtime) RenameSelect ¶ added in v0.42.0
RenameSelect is the rename.select setting: whether a rename opens with its text selected. Read at the moment a rename opens.
func (*Runtime) ResolveAction ¶ added in v0.28.0
func (r *Runtime) ResolveAction(name string) (Operation, Invocation, bool)
ResolveAction is the action a name runs and how it was named: the action's own key (noun aliases resolved: settings.set is ochazuke.settings.set) or an alias of it.
func (*Runtime) RetargetFocus ¶
RetargetFocus points every focus reference that match accepts (the focus, a page's remembered focus, an open modal's return) at to. A component that recreates its focused child (the grid's cell, the list's row) calls it after the move; staying inside one focus stop, it keeps the mode.
func (*Runtime) SearchCase ¶ added in v0.55.0
SearchCase is the search.case setting: smart, ignore or sensitive (smart for any other value, and on a nil runtime).
func (*Runtime) SearchMatch ¶ added in v0.59.0
SearchMatch is the search.match setting (substring for any other value and on a nil runtime).
func (*Runtime) SegmentCells ¶ added in v0.36.0
func (r *Runtime) SegmentCells() []SegmentCell
SegmentCells are the segments the header rule draws now: the active rows that have answered, in order. A failed refresh keeps the last text and draws it in state.errored; one that never answered draws its label and "!" in state.errored.
func (*Runtime) SegmentProvider ¶ added in v0.36.0
func (r *Runtime) SegmentProvider(name string, fn SegmentProvider)
SegmentProvider registers a Go source under name; a segment names it in its Provider field. A later registration of the name replaces it.
func (*Runtime) Segments ¶ added in v0.36.0
func (r *Runtime) Segments() []SegmentState
Segments lists every segment in drawing order, with whether it shows and its last answer.
func (*Runtime) SegmentsShown ¶ added in v0.36.0
SegmentsShown reports whether the segments area is on (its setting undeclared reads on).
func (*Runtime) SelectedBackground ¶ added in v0.43.0
SelectedBackground is the tones.selected-background setting's value (a row of settings/ochazuke.json, declared when the runtime is made, default drop).
func (*Runtime) SelectionMode ¶ added in v0.43.0
SelectionMode is the mode that selects shape ("" when none does); of several, the first by name.
func (*Runtime) SelectionShape ¶ added in v0.43.0
SelectionShape is the selection shape of mode, "" when the mode holds no selection.
func (*Runtime) SetAvailability ¶ added in v0.36.0
SetAvailability makes a registered action available only while the named guard holds (Available): what NounBuilder.When does for the verb it follows, for an operation registered with Register (the framework's components). An empty guard makes the action always available.
func (*Runtime) SetConfirm ¶
SetConfirm sets or clears (empty prompt) the confirm prompt of noun.verb.
func (*Runtime) SetFocus ¶
SetFocus points the focus at one instance: an input, a list, a row, a page or a modal body. Without a modal, the focus must sit inside the current page; a hidden page's instances are addressed with an explicit target.
func (*Runtime) SetMode ¶
SetMode sets the global mode by name and clears its payload, as mode.set does: a focused input runs its own transition (insert sessions, visual anchor), and a pinned input stays in its pinned mode.
func (*Runtime) SetPaneShift ¶ added in v0.4.0
SetPaneShift remembers page's divider, clamped to PaneShiftLimit either way, and writes the panes file (the state directory's PanesFile) when there is one; a failed write is a notice and the divider still holds for the session. It returns the shift kept.
func (*Runtime) SetPathBase ¶ added in v0.44.0
SetPathBase gives the folder path.start=base starts in when the parameter names none (the open file's folder); "" falls back to the working directory.
func (*Runtime) SetRecentPaths ¶ added in v0.44.0
SetRecentPaths gives the recent source's paths, newest first; the paths picked this run follow them.
func (*Runtime) SetTableState ¶ added in v0.12.0
func (r *Runtime) SetTableState(id string, s TableState)
SetTableState remembers the view of the table with this id and writes the tables file (the state directory's TablesFile) when it changed; a failed write is a notice and the view still holds for the session.
func (*Runtime) SetTerminalLeader ¶ added in v0.2.0
SetTerminalLeader sets the terminal-leader setting to key (declaring it first when the application has not), so every row naming the setting moves to key. A key that is not one ctrl+ or alt+ combination is refused.
func (*Runtime) SetWatchVersions ¶ added in v0.53.0
func (r *Runtime) SetWatchVersions(v WatchVersions) WatchVersions
SetWatchVersions sets where fallback watches keep their versions (nil: in memory, the default) and answers the previous keeper, to restore.
func (*Runtime) Settle ¶
Settle records the outcome of a running job and reports whether the ticket was current; a stale ticket leaves the list unchanged. Deliver settles the completions it routes; a component that runs its own commands settles the tickets it issued.
func (*Runtime) ShowMatch ¶ added in v0.59.0
ShowMatch is the search.show-match setting (on for a nil runtime).
func (*Runtime) ShowPage ¶ added in v0.41.0
ShowPage takes a page out of pages.hidden, back into the tabs in its registration place.
func (*Runtime) Sourced ¶
Sourced sets the source the requests executed until restore is called are recorded with, unless an outer caller already set one (a row run by a key inside a macro replay keeps "macro:q"). Callers: the resolver ("key:<keys>"), the transport ("cli"), the palette ("palette").
func (*Runtime) StandardShadows ¶ added in v0.53.0
StandardShadows lists, as info lines, every verb the application registered under a standard verb's name on a noun whose store would generate it: the named verb wins, and the standard one is not offered.
func (*Runtime) StandardVerbsView ¶ added in v0.53.0
func (r *Runtime) StandardVerbsView() StandardVerbsView
StandardVerbsView reads palette.standard-verbs: the first ordering part it holds (mixed when none), and the tag and record parts. Unknown parts are ignored. Read each time the palette lists or shows a result.
func (*Runtime) Start ¶
func (r *Runtime) Start(owner string, work func(context.Context) (any, error), then func(Ctx, any, error), c Ctx) (Ticket, error)
Start schedules accumulating work owned by an instance and returns its ticket; it is Launch with Pending(work).Then(then) under the verb "work".
func (*Runtime) StopBindings ¶ added in v0.2.0
func (r *Runtime) StopBindings() []StopBindings
StopBindings is the app-wide keyboard: the effective rows of every focus stop, as ListBindings gives them for the focus a jump to the stop lands on. The order is fixed: the pages in tab order (PageList), each page's stops in drawing order (the order focus.next walks, undrawn stops after in tree order), then the open modals bottom to top with theirs, then app in normal mode. The mode is the one the focus would have there: the current mode at the current focus, else the stop's pinned mode (a prompt is insert, a terminal terminal), else normal. Nothing moves: the focus and mode are back as they were on return.
It differs from bindings.list --all, which exports every stored row (each noun's and instance's tables, every mode, as configuration JSON), active or not: this answers "what does each key do where", after shadowing, guards and the modal boundary.
func (*Runtime) StoreYank ¶
StoreYank puts a yank into the shared registers with the bookkeeping the editor's yank operations use: the named or active register, the unnamed register, "0" for a yank or "1".."9" and "-" for a deletion, and the yank history. A component outside the package (a grid) yanks shapes the editor does not know ("column"), which register.set refuses, so it stores through this call and the editor still sees the text.
func (*Runtime) TabPages ¶ added in v0.41.0
TabPages are the pages the tab row draws and page.next/previous cycle, in registration order: every page not hidden, and the current page even when it is (it leaves the tabs once another page opens).
func (*Runtime) TableState ¶ added in v0.12.0
func (r *Runtime) TableState(id string) TableState
TableState is the remembered view of the table with this id (a list's or a grid's instance id): the zero TableState when none was kept.
func (*Runtime) TargetInstance ¶ added in v0.2.0
TargetInstance is the instance a request target names: the target when it is an instance, else what ResolveTarget maps it to. An unknown target is an error naming it.
func (*Runtime) TerminalLeader ¶ added in v0.2.0
TerminalLeader is the key that enters leader_pending: the terminal-leader setting (its embedded default before it is declared), DefaultTerminalLeader when that is not one ctrl+ or alt+ key. The rows that bind it name the setting ({terminal-leader}), so they follow it (binding_settings.go).
func (*Runtime) TreeBreadcrumb ¶ added in v0.43.0
TreeBreadcrumb is the tree.breadcrumb setting: line, title or off.
func (*Runtime) TreeBreadcrumbAncestors ¶ added in v0.43.0
TreeBreadcrumbAncestors is the tree.breadcrumb.ancestors setting: the hidden ancestors the breadcrumb names, 0 all of them.
func (*Runtime) TreeZoomMode ¶ added in v0.43.0
TreeZoomMode is the tree.zoom setting: manual, auto or off.
func (*Runtime) TreeZoomRoot ¶ added in v0.43.0
TreeZoomRoot is the tree.zoom.root setting: crumb or row.
func (*Runtime) UI ¶ added in v0.4.0
UI returns the UI component: Notify, ClearNotice, Error and Info for code without a Ctx (setup, daemon events), Attach for a host.
func (*Runtime) Unalias ¶ added in v0.57.0
Unalias removes a noun alias, so a host can rename a noun's short name while it runs (Unalias the old, Alias the new, or AddNounAlias it as deprecated). It is an error when alias names no noun.
func (*Runtime) UnreachableBindings ¶ added in v0.36.0
UnreachableBindings reports every stored row that can never answer (unreachableRows), table by table.
func (*Runtime) UseParamAliases ¶ added in v0.58.0
UseParamAliases is q with the old parameter names its alias takes moved to their parameters (ParamAlias), and the one-time notices of the deprecated ones it used, each returned once per runtime. Requests run through it (ExecuteAt posts the notices); a host reading words into a request before it runs (the CLI shell, which applies an alias's presets itself) calls it and shows the notices its own way.
func (*Runtime) UserActions ¶ added in v0.2.0
UserActions are the actions installed from actions.json, in file order.
func (*Runtime) UserAliases ¶ added in v0.28.0
func (r *Runtime) UserAliases() []ActionAlias
UserAliases are the alias rows installed from actions.json, in file order.
func (*Runtime) ValidateBindings ¶
ValidateBindings checks every row of every noun and instance table the way Bind checks a row it installs: keys or a pattern, a registered mode and guard, and a Request to a registered operation with known arguments and sources, or an unbind. Every row is therefore atomic. It is the check behind TestBindingRowsAreAtomic and is for an application to run after it loads its own rows.
func (*Runtime) VerbAvailability ¶ added in v0.55.0
VerbAvailability names every guard noun.verb is available under: its own (VerbGuard) first, then those AddVerbAvailability added, in order; nil when it has none.
func (*Runtime) VerbChecks ¶ added in v0.43.0
VerbChecks names the checks on a verb, in the order they run.
func (*Runtime) VerbShown ¶
VerbShown reports whether noun.verb is offered at a focus in a mode: true for an unguarded verb or one whose guard holds there. A guard name that is not registered hides nothing. It is Available for a request with no arguments.
func (*Runtime) Watch ¶ added in v0.53.0
Watch subscribes to noun's things: args are the watch verb's (the key prop for one thing, where, since). fn receives each event on the loop; nil queues them for Take. A store without a Watch handler is answered at once with the events since (every thing as added when since is empty). Stop ends it.
type Scheme ¶ added in v0.2.0
type Scheme struct {
Background string `json:"background,omitempty"`
Text SchemeColor `json:"text"`
Muted SchemeColor `json:"muted"`
Accent SchemeColor `json:"accent"`
Border SchemeColor `json:"border"`
Surface SchemeColor `json:"surface"`
Error SchemeColor `json:"error"`
Tones map[string]ToneStyle `json:"tones,omitempty"`
// contains filtered or unexported fields
}
Scheme is a named colour scheme: the palette roles NewStyles draws pages, panels, inputs and modals with. Background is which side of each role it draws: "adaptive" (the terminal's, the default), "light" or "dark". Text is body text and the title; Muted hints and inactive tabs; Accent the active tab, badge, subtitle and focused borders; Border unfocused panel borders; Surface the active tab's and badge's background; Error errors, kept apart from Accent and Muted. Selection stays reverse video in every scheme, so the selected row reads without colour.
type SchemeColor ¶ added in v0.2.0
SchemeColor is one palette role: Light is drawn on a light background, Dark on a dark one. Each is "#RRGGBB", "#RGB" or an ANSI index "0" to "255". In themes.json a role is one colour for both, or {"light": "...", "dark": "..."}.
func (*SchemeColor) UnmarshalJSON ¶ added in v0.2.0
func (c *SchemeColor) UnmarshalJSON(data []byte) error
UnmarshalJSON reads "#hex" (both sides) or {"light", "dark"} (a missing side takes the other).
type SchemeSet ¶ added in v0.2.0
type SchemeSet struct {
// contains filtered or unexported fields
}
SchemeSet is a read-only set of named schemes; a nil set is empty.
func NewSchemeSet ¶ added in v0.2.0
NewSchemeSet holds a copy of schemes.
type Segment ¶ added in v0.36.0
type Segment struct {
ID string `json:"id"`
Label string `json:"label,omitempty"`
Format string `json:"format,omitempty"`
Provider string `json:"provider,omitempty"`
Command Argv `json:"command,omitempty"`
Verb string `json:"verb,omitempty"`
Args Arguments `json:"args,omitempty"`
Every time.Duration `json:"-"`
Timeout time.Duration `json:"-"`
Tone string `json:"tone,omitempty"`
Order int `json:"order,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Path string `json:"path,omitempty"`
// Description is the line segment list and the segment's setting show.
Description string `json:"description,omitempty"`
// Owner is the settings owner of the segment's setting (a tab of the
// Settings page, Setting.Owner): an extension's segment names the
// extension's owner; "" is the declaring application's.
Owner string `json:"owner,omitempty"`
}
Segment is one status segment row. Format is a template over {{label}} and {{value}} (default "{{label}} {{value}}", or "{{value}}" without a label). Exactly one of Provider, Command and Verb is the source; Args are the verb's arguments. Every is the refresh interval (default DefaultSegmentEvery, at least MinSegmentEvery) and Timeout the most one refresh may take (default DefaultSegmentTimeout, at most Every). Tone is a named tone (tone.go) the text draws in, unless the answer brings its own (SegmentValue.Tone); none draws muted like the rule. Order sorts the rows (lower first, then the order they were added) before status.segment-order. Enabled is the default of the segment's setting (nil: on). Path is the provider's path (disk free reads it).
In segments.json the durations are strings ("2s"), as settings.json writes them.
func (Segment) MarshalJSON ¶ added in v0.36.0
MarshalJSON writes the durations as strings ("2s").
func (*Segment) UnmarshalJSON ¶ added in v0.36.0
UnmarshalJSON reads the durations as strings ("2s", "500ms"); an unknown field is an error.
type SegmentCell ¶ added in v0.36.0
SegmentCell is one drawn segment: its text and tone ("" muted).
type SegmentMsg ¶ added in v0.36.0
type SegmentMsg struct {
ID string
Value SegmentValue
Err error
}
SegmentMsg is a refresh's answer, delivered on the loop.
type SegmentProvider ¶ added in v0.36.0
type SegmentProvider func(ctx context.Context, s Segment) (SegmentValue, error)
SegmentProvider is a Go source: it returns the segment's value, off the loop, within ctx's deadline (the segment's Timeout).
type SegmentState ¶ added in v0.36.0
type SegmentState struct {
Segment
Source string `json:"source"` // provider, command or verb
From string `json:"from"` // app, or segments.json
Shown bool `json:"shown"` // its setting is on (and the area is)
Position int `json:"position"`
Text string `json:"text,omitempty"`
Error string `json:"error,omitempty"`
At time.Time `json:"at,omitzero"`
}
SegmentState is a segment as segment.list and segment.show answer: the row as merged, where it came from, whether it shows, its position and its last answer.
type SegmentTickMsg ¶ added in v0.36.0
SegmentTickMsg is the segments' one-shot timer: it fires at the earliest next refresh of a shown segment (Model.segmentCommand), so a reading changes on an idle screen. At is the deadline it was scheduled for; only the message for the timer in flight clears it. Nothing shown, nothing is scheduled.
type SegmentValue ¶ added in v0.36.0
SegmentValue is one answer of a source: the text and, optionally, the tone it draws in (a disk nearly full answers state.errored).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves runtime requests over a Unix socket; see Listen.
type Setting ¶ added in v0.2.0
type Setting struct {
Name string `json:"name"`
Type string `json:"type"`
Default any `json:"default"`
Description string `json:"description,omitempty"`
Enum []string `json:"enum,omitempty"`
// Owner says which owner (a tab of the Settings page) the setting
// belongs to: "" is the declaring application (OwnerApp), unless the
// framework declares it (its embedded rows, a feature's declaration
// inside Runtime.Builtin: OwnerFramework). An application that
// declares a framework row's name to change its default keeps the
// framework's owner unless it sets Owner itself. Settings.OwnerOf
// resolves it.
Owner string `json:"owner,omitempty"`
// Section files the setting under a section of its owner; "" takes
// the name before its first dot ("tree.zoom.root" is in "tree"), and
// a name without a dot is in SettingsGeneralSection (SectionName).
// DeclareSettingSection gives a section its title, order and line.
Section string `json:"section,omitempty"`
// Group, when set, puts the setting under a heading row of that name
// inside its section (the schedules of an application, each with its
// own settings).
Group string `json:"group,omitempty"`
// Validate, when set, checks a value of the right type further: Set
// refuses a value it rejects and a file value it rejects reads the
// default, as a value of the wrong type does.
Validate func(value any) error `json:"-"`
// Deprecated are older names of the setting, kept for one release:
// settings.get, set and reset, Value and settings.json read them as
// this setting, each warning once, and a write moves the file's value
// to this name. A declaration under an old name declares this one.
Deprecated []string `json:"deprecated,omitempty"`
}
Setting is one declared user preference: its name, type, default, the line the settings list shows and, for a string, the allowed values. Settings are not for secrets: the file is plain JSON in the config directory.
func (Setting) SectionName ¶ added in v0.7.0
SectionName is the section the Settings page files the setting under: Section when declared, else the name before its first dot ("tree.zoom.root" is in "tree"), else SettingsGeneralSection.
type SettingDiff ¶ added in v0.50.0
type SettingDiff struct {
Name string `json:"name"`
Type string `json:"type"`
Saved any `json:"saved"`
SavedIn string `json:"savedIn"`
Session any `json:"session"`
Origin Origin `json:"origin"`
}
SettingDiff is one setting whose session value differs from its persisted one, as settings.diff answers: the name, the persisted value (settings.json's, else the default: SavedIn says which, "file" or "default"), the session value, both in their file form, and the session value's origin.
type SettingOwner ¶ added in v0.55.0
type SettingOwner struct {
ID string `json:"id"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Order int `json:"order,omitempty"`
}
SettingOwner declares an owner of settings: a tab of the Settings page. Owners are drawn by Order (lowest first), then in the order they were declared, then the owners nobody declared in the order of their first setting. The framework declares the application (OwnerApp, order 0) and itself (OwnerFramework, order 100), so an application's owners (one for its extensions) fall between them unless they give an Order.
type SettingOwnerInfo ¶ added in v0.55.0
type SettingOwnerInfo struct {
SettingOwner
Sections int `json:"sections"`
Settings int `json:"settings"`
Session int `json:"session,omitempty"`
}
SettingOwnerInfo is an owner as settings.owners answers: the declaration filled in (the title resolved), with its section and setting counts and how many of its settings hold a session value.
type SettingSection ¶ added in v0.55.0
type SettingSection struct {
Owner string `json:"owner,omitempty"`
ID string `json:"id"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
}
SettingSection declares a section of an owner's settings: its title, the line the page shows while the section list has the focus, and its place: declared sections come first, in declaration order, then the rest in the order of their first setting. Owner "" declares the section for every owner (the framework's General); an owner's own declaration wins.
type SettingSectionInfo ¶ added in v0.55.0
type SettingSectionInfo struct {
SettingSection
Settings []string `json:"settings"`
Session int `json:"session,omitempty"`
}
SettingSectionInfo is a section as settings.sections answers: the declaration filled in (owner and title resolved) with its settings' names in page order (by group, each group in declaration order) and how many hold a session value that differs from the saved one.
type SettingShown ¶ added in v0.50.0
type SettingShown struct {
SettingValue
Line string `json:"line"`
Origin *Origin `json:"origin,omitempty"`
}
SettingShown is setting.show's answer: the setting, its value and the line the status line shows (name=value, name or noname), with the origin when verbose.
type SettingValue ¶ added in v0.2.0
type SettingValue struct {
Setting
Value any `json:"value"`
Set bool `json:"set"`
Session bool `json:"session,omitempty"`
Saved any `json:"saved,omitempty"`
}
SettingValue is a setting with its current value, as settings.list and settings.get answer: Value and Default in their file form (a duration as "400ms"), Set when settings.json holds a value for it. Session is set when the value is a session value (settings_session.go), and Saved is then the persisted value beneath it (settings.json's, else the default).
type SettingWritten ¶ added in v0.50.0
type SettingWritten struct {
SettingValue
Written string `json:"written"`
}
SettingWritten is a value verb's answer: the setting with its value after the write and the layer written, session or file (a runtime with no session writes the file: "saved: no running session").
type Settings ¶ added in v0.2.0
type Settings struct {
// contains filtered or unexported fields
}
Settings holds the declared settings and their values from settings.json in the config directory. It is part of the config component, reached through Runtime.Settings(). The file is read on first use (and again when the config directory changes), written atomically (a temp file renamed over it) on every Set and Reset, and keeps every key it holds: an unknown or invalid key is reported and written back unchanged, never dropped. Without a config directory the values last for the session. Model polls the file (SettingsPoll) so a value another process set (the CLI) reaches a running TUI.
func (*Settings) Autosave ¶ added in v0.50.0
Autosave is the settings.autosave setting: session writes go to the file.
func (*Settings) Declared ¶ added in v0.2.0
Declared lists the declared settings in declaration order.
func (*Settings) Diff ¶ added in v0.50.0
func (s *Settings) Diff() []SettingDiff
Diff lists the settings whose session value differs from the persisted one, in declaration order: what settings.write would write and the review screen shows.
func (*Settings) FrameworkSetting ¶ added in v0.51.0
FrameworkSetting reports whether the framework declared the setting (its fixed rows, or a feature's), not the application.
func (*Settings) Get ¶ added in v0.2.0
func (s *Settings) Get(name string) (SettingValue, error)
Get is one setting with its value.
func (*Settings) HasSession ¶ added in v0.50.0
HasSession reports whether the runtime has a session (StartSession).
func (*Settings) List ¶ added in v0.2.0
func (s *Settings) List() []SettingValue
List is every declared setting with its value, in declaration order.
func (*Settings) Observe ¶ added in v0.2.0
Observe calls fn with a setting's new value whenever it changes (Set, Reset, or a reload that read another value); name "" observes every setting. Observers run on the caller's goroutine, the update loop.
func (*Settings) OwnerOf ¶ added in v0.55.0
OwnerOf is the owner the named setting files under ("" for an unknown name).
func (*Settings) Owners ¶ added in v0.55.0
func (s *Settings) Owners() []SettingOwnerInfo
Owners is every owner holding a setting, in the Settings page's order.
func (*Settings) Problems ¶ added in v0.2.0
Problems are the problems the last read of settings.json found.
func (*Settings) Reload ¶ added in v0.2.0
Reload reads settings.json again and tells the observers of every value that changed. It returns the problems the file has. A session value stays on top of what the file now holds; a setting whose file value changed is marked changed on disk (Origin.Disk).
func (*Settings) ReloadIfChanged ¶ added in v0.2.0
ReloadIfChanged reloads when the file changed on disk since it was last read or written (another process set a value); it reports whether it did.
func (*Settings) Reset ¶ added in v0.2.0
Reset removes a setting's value from settings.json, so it reads its default again; its session value is dropped too.
func (*Settings) ResetAll ¶ added in v0.50.0
ResetAll sets every setting back to its default by the writes-through rule: with a session (and autosave off) each setting not at its default gets the default as a session value (Write removes the file's keys, RevertAll takes it back); otherwise every declared setting's key is removed from settings.json in one write (unknown keys stay) and the session values are dropped. It returns the layer written and the names it reset.
func (*Settings) ResetSession ¶ added in v0.50.0
ResetSession sets a setting back to its default for this session (the file keeps its value until Write, which then removes it), or resets the file (Reset) when the runtime has no session or autosave is on. It returns the layer written.
func (*Settings) Revert ¶ added in v0.50.0
Revert drops a setting's session value, so settings.json's value (or the default) shows again. A setting without one is left alone.
func (*Settings) RevertAll ¶ added in v0.50.0
RevertAll drops every session value; it returns the names reverted.
func (*Settings) Sections ¶ added in v0.55.0
func (s *Settings) Sections(owner string) ([]SettingSectionInfo, error)
Sections is an owner's sections in the Settings page's order; owner "" is every owner's, owner by owner.
func (*Settings) Session ¶ added in v0.50.0
Session is a setting's session value, typed, false when it has none.
func (*Settings) Set ¶ added in v0.2.0
Set validates value against the setting's type and enum (a string is parsed: "3", "true", "400ms"), writes settings.json and tells the observers. A value that does not validate changes nothing. Writing the file drops the setting's session value, so what was written shows.
func (*Settings) SetSession ¶ added in v0.50.0
SetSession sets a setting for this session: value is checked as Set checks it and lives above settings.json, unwritten. It writes the file instead (Set) when the runtime has no session or settings.autosave is on. It returns the layer written, OriginSession or OriginFile.
func (*Settings) StartSession ¶ added in v0.50.0
func (s *Settings) StartSession()
StartSession marks the runtime as having a session: a running UI whose session values last until it exits. Model.Init calls it. A runtime without one (a one-shot CLI process, a script) writes every session write to settings.json.
func (*Settings) String ¶ added in v0.2.0
String is a string setting's value ("" when undeclared or another type).
func (*Settings) Strings ¶ added in v0.8.0
Strings is a list setting's value, a copy (nil when undeclared or another type).
func (*Settings) Value ¶ added in v0.2.0
Value is a setting's current value (the session's when it holds one, else the file's when it holds a valid one, else the default), typed as its getter returns it.
type SettingsApplied ¶ added in v0.50.0
type SettingsApplied struct {
Shown []string `json:"shown,omitempty"`
Changed []SettingValue `json:"changed,omitempty"`
}
SettingsApplied is settings.apply's answer for a line that is not a list form: what it showed and the settings it changed, with their values after.
type SettingsPollMsg ¶ added in v0.2.0
type SettingsPollMsg struct{}
SettingsPollMsg is the Model's settings.json check.
type SplitSide ¶ added in v0.2.0
type SplitSide int
SplitSide names the panel of a split that draws focused.
type StandardVerbsView ¶ added in v0.53.0
StandardVerbsView is what palette.standard-verbs asks of the palette: the ordering of the verb column and whether the std tag and get's record rows show.
type StopBindings ¶ added in v0.2.0
type StopBindings struct {
Page string `json:"page,omitempty"`
Stop string `json:"stop"`
Focus string `json:"focus"`
Mode string `json:"mode"`
Bindings []Binding `json:"bindings"`
}
StopBindings is one entry of bindings.stops: the rows a focus stop answers to (ListBindings at Focus in Mode), with the page it sits on. Stop is the stop instance, Focus where a jump to it lands (its remembered child, a list's selected row), Mode the mode the focus has there. The last entry is app itself (Stop and Focus "app").
type Store ¶ added in v0.52.0
type Store struct {
Kind string
Get func(Ctx, string) (Thing, error)
List func(Ctx, ListQuery) ([]Thing, error)
Create func(Ctx, Thing) (Thing, error)
Patch func(Ctx, string, Thing) (Thing, error)
Delete func(Ctx, string) error
ListParams map[string]Parameter
Watch func(c Ctx, q WatchQuery, emit func(WatchEvent)) (stop func(), err error)
Confirm map[string]string
// ConfirmFor builds the prompt a standard verb that asks (delete, or
// one Confirm gives a prompt) asks for one request: it gets the
// request's context and arguments, the verb, the keys of the things
// it acts on (one, or a visual selection's) and the prompt it would
// ask (Confirm's, the default, or the archive prompt), and answers
// the template to ask ({{noun}}, {{label}} and the rest still
// expand); "" asks nothing. It is how a store says what a delete
// costs (a task's subtasks and notes left without it) without
// replacing the standard verb. nil asks the prompt as it is.
ConfirmFor func(c Ctx, verb string, keys []string, prompt string) string
When map[string]string
// Undo lets history.undo revert this store's standard changes
// (standard_undo.go); AcceptsKey says Create keeps a key the values
// give, so a delete can be undone under its old key.
Undo bool
AcceptsKey bool
// Live, on an instances store, answers the ids of the live instances
// that are its things, in order; nil is every instance of the noun in
// registration order. (Pages are ochazuke.page's things whatever noun
// their instances have.)
Live func(r *Runtime) []string
}
Store is a noun's row in the handler table: its kind and the handlers that read and write its things, each optional. A standard verb exists on the noun exactly when its handler is set (standardVerbs' Needs). Get answers the thing with that key ("" for a singleton); List answers the things. ListParams are list's parameters beside where, props and limit.
Create stores a new thing from the props given (typed, each prop's Default filling an omitted one) and answers it, its key filled. Patch writes the changed props of the thing with that key and answers the thing after the write (nil: the runtime reads it back with Get). Delete removes the thing with that key.
Confirm is a standard verb's confirm prompt by verb ({{label}} is the thing's label prop, else its Fallback); delete asks DefaultDeleteConfirm unless the store names its own ("" asks nothing). When is a standard verb's availability by verb: a guard name, set on the generated verb as SetAvailability does.
Watch, when set, answers watch itself (standard_watch.go): it pushes each event to emit, from any goroutine, until stop; without it watch lists again (List, a singleton's Get) whenever things may have changed.
type Styles ¶
type Styles struct {
Title lipgloss.Style
Subtitle lipgloss.Style
Muted lipgloss.Style
Accent lipgloss.Style
Error lipgloss.Style
Panel lipgloss.Style
FocusedPanel lipgloss.Style
Tab lipgloss.Style
ActiveTab lipgloss.Style
Badge lipgloss.Style
Padding int
// Backdrop draws what a modal covers (modal-dim); Unfocused draws a page
// list without the focus (dim-unfocused). Either is the empty style when
// its dim is 0. WithDims sets both from percents.
Backdrop lipgloss.Style
Unfocused lipgloss.Style
// contains filtered or unexported fields
}
Styles is a render-time value; it does not retain mutable appearance state.
func NewStyles ¶
func NewStyles(a Appearance) Styles
NewStyles keeps layout and focus cues usable without terminal color support. Theme names the scheme (a built-in theme or one of Schemes; an unknown name draws adaptive); mono and NO_COLOR draw no colour at all.
func (Styles) CardBorders ¶ added in v0.23.0
CardBorders are the border styles of a card timeline's three states (the selection is the border, never reverse video): selected while the timeline has the focus, the accent in bold; selected without the focus, halfway from the accent to the border role; every other card, the border role faded toward the surface by dim-unfocused. With no colour (mono, NO_COLOR) they are bold, plain and faint; the timeline also draws the two selected states in heavy lines, so they read without any attribute.
func (Styles) Chrome ¶ added in v0.59.0
Chrome is the style of a chrome role at the current level: fallback with the colours the row chrome.<level>.<role> names laid over it and the row's attributes (bold, dim), or fallback itself when the scheme has no such row. fallback keeps everything a row does not set (padding, borders, a colour the row leaves empty).
func (Styles) ChromeLevel ¶ added in v0.59.0
ChromeLevel is the level WithChrome set ("" before it).
func (Styles) Fade ¶ added in v0.10.0
Fade is a style that carries text percent of the way from the scheme's text colour toward its surface, blended in CIELAB (fadeRamp, lipgloss.Blend1D); with no colour (mono, NO_COLOR) any percent above 0 is the faint attribute. 0 is the empty style.
func (Styles) HasChrome ¶ added in v0.59.0
HasChrome reports whether any of the roles has a row at the current level.
func (Styles) Tone ¶ added in v0.26.0
Tone is the style a tone draws in outside a list (an application's own line, a footer): its colour and attributes, the empty style for an unknown tone; mono and NO_COLOR keep the attributes alone.
func (Styles) WithBackdropHighlights ¶ added in v0.55.0
WithBackdropHighlights says whether a modal's backdrop keeps the page's reverse video and underline (true, the default) or drops them (modal-highlights plain).
func (Styles) WithChrome ¶ added in v0.59.0
WithChrome sets the chrome level (chrome.color) and the current mode's badge role chain (Runtime.modeRoles): the badge takes the first row of the chain that exists, the mode role its colour, and the panel styles their level's border rows. Level off, or a level with no rows, leaves every style as it was.
type Suggestion ¶ added in v0.5.0
type Suggestion struct {
Text string `json:"text"`
Label string `json:"label,omitempty"`
Detail string `json:"detail,omitempty"`
}
Suggestion is one completion a search offers. Text replaces the token after its trigger; Label is what the list shows ("" shows Text); Detail is drawn muted after the label.
type TableState ¶ added in v0.12.0
type TableState struct {
Column int `json:"column,omitempty"`
Widths map[int]int `json:"widths,omitempty"`
Pins *[]int `json:"pins,omitempty"`
Version int `json:"version,omitempty"`
}
TableState is what a table remembers across a restart: its current column (a cell-mode table's), the widths its columns were given with z > and z < (column index to cells; a column left out is automatic) and the pinned columns the user chose (any table's; nil keeps the default pins, an empty list pins none).
Version is the format the widths were written in: tableStateVersion (1) since a row-select table remembers the widths z F gives it; a row-select table ignores widths without it (left by v0.12.0, when every table was cell-based).
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal is the component of a terminal instance: it holds the last frame the stream delivered, renders it into the area a page gives it and reports the pane's cursor. Frames arrive through the delivery contract as Completions owned by the instance in the "read" slot, one read at a time, so a frame that arrives after Close, or after a newer read started, is stale and dropped before it reaches the component.
func (*Terminal) Close ¶
func (t *Terminal) Close()
Close stops reading and releases a TerminalReleaser stream, once; the runtime has already cancelled the read in flight.
func (*Terminal) Frame ¶
func (t *Terminal) Frame() TerminalFrame
Frame is the last frame the stream delivered.
func (*Terminal) HandleMessage ¶
HandleMessage stores a frame delivered to this terminal and schedules the next read. A stream error ends reading; a cancelled read is silent.
func (*Terminal) Overlay ¶ added in v0.14.0
func (t *Terminal) Overlay() *TerminalOverlay
Overlay is the overlay SetOverlay set, nil for none.
func (*Terminal) PendingCommand ¶
PendingCommand is nil: reads are scheduled through Runtime.Start.
func (*Terminal) SetOverlay ¶ added in v0.14.0
func (t *Terminal) SetOverlay(o *TerminalOverlay)
SetOverlay draws o over the pane from the next frame on; nil clears it. The overlay stays until the application clears or replaces it: a new frame from the stream does not clear it, and neither do a focus change, a mode change or a detach, so an application that pairs it with a mode clears it where it leaves the mode (and in its own focus or close handling). It changes only what ViewBlock draws: Frame, the stream and every other reader of the pane see the pane's own cells.
type TerminalFrame ¶
type TerminalFrame struct {
Lines []string `json:"lines"`
Cursor Pos `json:"cursor"`
Shape string `json:"shape,omitempty"`
Hidden bool `json:"hidden,omitempty"`
}
TerminalFrame is one rendering of a pane: its rows of trusted ANSI, the cursor cell, the cursor shape the pane reports ("block", "bar", "underline"; "" for the default block) and whether the cursor is hidden.
type TerminalOverlay ¶ added in v0.14.0
type TerminalOverlay struct {
Dim bool `json:"dim,omitempty"`
Marks []OverlayMark `json:"marks,omitempty"`
}
TerminalOverlay is what an application draws over a terminal's frame without touching the frame: Dim fades the pane's cells (the modal-dim backdrop style; faint in mono and NO_COLOR) and each mark replaces the cells it covers. Hints over a live pane (labels on its URLs and paths) are an overlay plus an application mode; see SetOverlay.
type TerminalReleaser ¶
type TerminalReleaser interface {
Release() error
}
TerminalReleaser is a TerminalStream that holds something to give back when its terminal closes: a daemon size lease, a connection. Terminal.Close calls Release once, so Pop, SetItems, RemoveInstance and a CloseOnDetach detach all release the stream; its error is kept as the terminal's Err.
type TerminalStream ¶
type TerminalStream interface {
Next(ctx context.Context) (TerminalFrame, error)
Send(keys ...string) error
Paste(text string) error
Resize(cols, rows int) error
}
TerminalStream is the application's connection to one pane: a daemon client, never a PTY the framework owns. The framework reads frames from it, forwards keys and pasted text to it and tells it the pane's size. Next blocks until the pane changes and returns its next frame; it returns ctx's error when the terminal instance closes or newer work supersedes the read. Keys are named as bindings spell them ("ctrl+a", "d", "esc").
type ThingChange ¶ added in v0.53.0
type ThingChange struct {
Noun string `json:"noun"`
Key string `json:"key,omitempty"`
Before map[string]any `json:"before,omitempty"`
After map[string]any `json:"after,omitempty"`
Undone bool `json:"undone,omitempty"`
}
ThingChange is what one standard write did to one thing: its noun and key, and the props it changed with their values before and after, in their file form. Before is nil for a create, After nil for a delete. Undone marks a change history.undo reverted.
type Ticket ¶
type Ticket struct {
Owner string `json:"owner"`
Job uint64 `json:"job"`
Slot string `json:"slot,omitempty"`
}
Ticket names one job: the instance that owns it, its runtime-wide id and the slot it was started in. Slot is "" for a job that accumulates (every completion is delivered, in finish order) and a name for a job that replaces: a newer job in the same slot on the same owner (or, with ReplacingAt, on the same scope) drops the older. A completion is stale, and dropped, only when its job was cancelled by a newer job in its slot or by its owner closing.
type Timeline ¶ added in v0.17.0
type Timeline struct {
// contains filtered or unexported fields
}
Timeline is a scrolling column of cards of varying height, each a box (Card). The selection, motions, counts, spills, the / filter and the card instances are those of a list child (id+"/list") whose rows are the cards, so j/k, g g, ctrl+d/ctrl+u and 3j behave as on any page list; the timeline draws the cards itself, in a window of its own measured in lines (top, the first card drawn and how many of its lines are above the window), and reports the selected card's lines with PlacedAt so the page keeps it on screen.
Selection rule (the cards' exception to a page list's reverse video): the selection is the border, and no text on a card is ever reversed. The selected card of a focused timeline has a heavy border with heavy corners in the accent, bold; the selected card of a timeline without the focus a heavy border with rounded corners halfway from the accent to the border role; every other card a light rounded border in the border role faded by dim-unfocused (Styles.CardBorders). Header, meta and body text keep their own styles whether selected or not. A timeline without the focus is also faded as a whole (dim-unfocused), as a page list is.
func (*Timeline) BodyID ¶ added in v0.30.0
BodyID is the id of the instance that holds the focus inside a card.
func (*Timeline) CanScrollLines ¶ added in v0.50.0
scroll moves the window by lines (down when positive) without moving the selection unless it would leave the window (it then lands on the nearest card on screen). Scrolling up stops following the end. CanScrollLines reports whether the last frame did not show every line (LineScroller, view.scroll).
func (*Timeline) FocusTarget ¶ added in v0.17.0
FocusTarget is where a jump to the timeline lands: its selected card.
func (*Timeline) Folded ¶ added in v0.17.0
Folded reports whether section (its Name, Title or number from 1) of the card with id is folded.
func (*Timeline) Following ¶ added in v0.17.0
Following reports whether the timeline follows its end (FollowTail).
func (*Timeline) InBody ¶ added in v0.30.0
InBody reports whether the focus is inside the selected card.
func (*Timeline) List ¶ added in v0.17.0
List is the list whose rows are the cards (selection, motions, filter).
func (*Timeline) Patch ¶ added in v0.17.0
Patch updates the cards with these ids in place and appends the others at the end, in order: the cheap path for a streaming last card (bump its Revision) or a new one. The list's rows are rebuilt only when a card is added or its noun, label or data changed.
func (*Timeline) ScrollLines ¶ added in v0.50.0
ScrollLines is timeline.scroll by lines (LineScroller).
func (*Timeline) Select ¶ added in v0.17.0
Select selects the card with id without taking the focus.
func (*Timeline) Selected ¶ added in v0.17.0
Selected is the selected card; an empty timeline has none.
func (*Timeline) SelectedID ¶ added in v0.17.0
SelectedID is the selected card's id, or "".
func (*Timeline) SetAllOpen ¶ added in v0.17.0
SetAllOpen opens or closes every card.
func (*Timeline) SetCards ¶ added in v0.17.0
SetCards replaces the cards, keyed by id: the selection, open cards and section folds follow their ids (as List.SetItems keeps the selection), a new card starts as its Open says. While the timeline follows its end (FollowTail) and the last card is selected, the new last card is selected. Invalid cards leave the timeline unchanged.
func (*Timeline) SetFolded ¶ added in v0.17.0
SetFolded folds or unfolds a section of the card with id (section is its Name, Title or number from 1).
func (*Timeline) SetParentStop ¶ added in v0.30.0
SetParentStop changes where h on a closed card goes ("" stays).
func (*Timeline) Step ¶ added in v0.30.0
Step is the card the focus is inside and its current step (from 0); false outside a card.
func (*Timeline) StepText ¶ added in v0.30.0
StepText is the current step's text (what y yanks); false outside a card.
func (*Timeline) View ¶ added in v0.17.0
View draws the cards in a width by height window and records the timeline in its page's drawing order (Placed) with the selected card's lines (PlacedAt). When the cards overflow, the last line reads which cards are on screen, "3–5 / 40". A filter line (/) takes the first line.
type ToneSpan ¶ added in v0.26.0
type ToneSpan struct {
Cell int `json:"cell"`
Tone string `json:"tone,omitempty"`
Bg string `json:"bg,omitempty"`
From int `json:"from,omitempty"`
To int `json:"to,omitempty"`
}
ToneSpan gives a run of one cell a tone. Cell is the column index (in a list without columns, and a tree without them, 0 is the label); From and To are rune offsets into the cell's text as drawn (escape sequences, which a cell never draws, do not count), To 0 meaning the cell's end, so {Cell, Tone} alone tones the whole cell. A later span wins where two overlap; a span outside the text draws nothing. Bg names a tone (a theme token) whose background goes under the span while Tone keeps the foreground and attributes; Bg alone, with no Tone, only fills. Where spans overlap, the foreground comes from the last span with a Tone and the background from the last span that has one.
type ToneStyle ¶ added in v0.26.0
type ToneStyle struct {
Fg SchemeColor `json:"fg"`
Bg SchemeColor `json:"bg,omitzero"`
Bold bool `json:"bold,omitempty"`
Dim bool `json:"dim,omitempty"`
}
ToneStyle is how a scheme draws one tone: Fg is a colour as a scheme role takes it ("#RRGGBB", "#RGB", an ANSI index, {"light", "dark"}) or the name of a palette role (text, muted, accent, border, surface, error) so the tone follows the scheme; empty keeps the text's colour. Bg is the background, a colour or role the same way; empty draws none. Bold and Dim (faint) are the attributes, the only part mono draws. In themes.json a tone is {"fg": ..., "bg": ..., "bold": true, "dim": true}, or a colour or role alone ("#5FAFD7", "error").
func (*ToneStyle) UnmarshalJSON ¶ added in v0.26.0
UnmarshalJSON reads a colour or role alone, or {"fg", "bg", "bold", "dim"}.
type Tree ¶
type Tree struct {
// OnChange makes the tree editable and receives each change as it is
// made; an error keeps the change on screen, marks the row and retries
// it before the next change.
OnChange func(TreeChange) error
// NewID names a new node (default "<tree>-n<seq>").
NewID func() string
// RowNoun is the noun of nodes the tree adds (default TreeRowNoun).
RowNoun string
// Refuse is the application's check on a change before it is made
// (rename, move, delete and add; for add the node is the parent, the
// zero node at the top): a non-nil error refuses it with that reason,
// from every path. It runs after the nodes' Fixed. Undo and redo are
// not checked: they take back changes that were allowed.
Refuse func(node TreeNode, change TreeChange) error
// Debounce is the pause in typing before a line is written.
Debounce time.Duration
// contains filtered or unexported fields
}
Tree is a list whose rows are nested nodes: expand and collapse, the same motions as a list (it is one: rows spill to the neighbouring stops in drawing order), the one highlighted row, columns like a table. Given OnChange it is an outline editor: every structural edit is written at once, typing within a line is written after a pause (Debounce) and when the line is left, undo and redo are changes too, and esc never discards.
The tree is an instance of the outline noun with a list child (id+"/list") holding the visible rows; editing adds an input (id+"/line", noun outline-line) under the tree while a line is edited. (The nouns are "outline", not "tree", so palette prefixes such as "tr" stay unique in apps.)
func (*Tree) Block ¶
Block renders the rows as the list does; while a line is open its row is the input, with the terminal cursor in it. A zoomed tree draws its breadcrumb line above the rows (tree.breadcrumb line) when there is room for a row under it; the frame first applies tree.zoom (frameZoom).
func (*Tree) Breadcrumb ¶ added in v0.43.0
Breadcrumb is the zoom's path as the breadcrumb shows it, outermost first: the hidden ancestors (the nearest tree.breadcrumb.ancestors of them named, farther ones folded into one "…"), then the zoomed node when it is not a row (tree.zoom.root crumb). Nil when not zoomed.
func (*Tree) CollapseAll ¶
CollapseAll collapses every node that has children.
func (*Tree) DebounceCurrent ¶
func (t *Tree) DebounceCurrent(tick TreeDebounceMsg) bool
DebounceCurrent reports whether a pause timer is for the line's latest change (an older timer writes nothing).
func (*Tree) DebounceTick ¶ added in v0.16.0
func (t *Tree) DebounceTick() (TreeDebounceMsg, bool)
DebounceTick is the pause timer in flight, for a host that delivers it at once (explore): false when no typing waits on one.
func (*Tree) Edit ¶ added in v0.38.0
Edit opens a node's line as outline.edit does; selected opens it with its text selected, so typing replaces it (Input.SelectText).
func (*Tree) Failure ¶
Failure is the last background failure, cleared when read: Deliver returns it for the message the tree handled, so it reaches the status.
func (*Tree) FocusTarget ¶
FocusTarget is where a jump to the tree lands: its selected row.
func (*Tree) HandleMessage ¶
HandleMessage writes the open line when its pause timer is the latest.
func (*Tree) Height ¶ added in v0.43.0
Height is the lines the tree needs to draw every visible row without windowing (a table's header aside): its list's Height, plus the breadcrumb line while a zoom draws one. A host that sizes a tree to its rows sizes it with Height.
func (*Tree) PendingCommand ¶
PendingCommand notices typing in the open line and sets the pause timer; a line whose input lost the focus is closed (and written).
func (*Tree) Record ¶ added in v0.1.1
func (t *Tree) Record(a TreeAction) error
Record puts an application change on the undo stack: an open line is sealed first (so its typing undoes after the action, not before), and the redo stack is cleared, as for any new change.
func (*Tree) SetCollapsed ¶
SetCollapsed collapses or expands one node.
func (*Tree) SetNodes ¶
SetNodes replaces the nodes, keeping collapse state and the selection by id. Nodes must list each parent before its children.
func (*Tree) Zoom ¶ added in v0.43.0
Zoom draws only id's subtree (tree.zoom.root says whether id is the top row or ends the breadcrumb); "" shows every level again. The selection stays when it is inside the zoom, else moves to the first row in it. Zoom works whatever tree.zoom says; off only drops it at the next frame.
type TreeAction ¶ added in v0.1.1
type TreeAction struct {
ID string
Label string // what the change is ("done n1"), for logs
Undo func() error
Redo func() error
}
TreeAction is an application change that goes on an outline's undo stack in order with the tree's own edits: a change the application keeps outside the tree's nodes, such as a task's status. u runs Undo and ctrl+r runs Redo; each is written by the application like any change. ID is the node selected after either runs ("" keeps the selection).
type TreeChange ¶
type TreeChange struct {
Op string `json:"op"`
ID string `json:"id"`
Parent string `json:"parent,omitempty"`
Index int `json:"index"`
Text string `json:"text,omitempty"`
}
TreeChange is one committed edit of an outline: add, rename, move or delete. Index is the node's position among its parent's children after the change. The application writes each one to its store as it comes (Tree.OnChange); undo is a further change, never a discard.
func (TreeChange) String ¶
func (c TreeChange) String() string
String reads a change in one line: "add n1 under root at 1: text", "rename n1: text", "move n1 under a at 0", "delete n1".
type TreeDebounceMsg ¶
TreeDebounceMsg is the timer a pause in typing sets off: when Seq is still the line's latest change, the line is written.
type TreeNode ¶
type TreeNode struct {
ID string `json:"id"`
Parent string `json:"parent,omitempty"`
Label string `json:"label"`
Noun string `json:"noun,omitempty"`
Data any `json:"data,omitempty"`
Cells []string `json:"cells,omitempty"`
Tones []ToneSpan `json:"tones,omitempty"`
// Section is the label line drawn above a run of rows in one section
// (ListItem.Section); "" none.
Section string `json:"section,omitempty"`
// Fixed names the changes the node refuses: TreeRename, TreeMove
// (move, indent, outdent) and TreeDelete (deleting it or any
// ancestor). An outline's document root is Fixed all three; an array
// item, whose key is its index, refuses rename alone. The refusal holds
// from every path (keys, the palette, the CLI, Tree methods); the verb
// is not available on the node (outline-renamable, outline-movable,
// outline-deletable), so its hints and help rows drop out.
Fixed []string `json:"fixed,omitempty"`
}
TreeNode is one node of a tree. Nodes are flat and in display order: a node's children follow it, and Parent "" is a root. Noun is the row's noun (default TreeRowNoun); Data, Cells and Tones are as on ListItem (cell 0 is the label: its tones stay on it, after the indent and fold marker).
type UI ¶ added in v0.4.0
type UI struct {
// contains filtered or unexported fields
}
UI is the component that routes handler messages to the host's sink. It is one instance under app (Runtime.UI), never a Runtime field. With no sink it discards, except that until the first sink attaches it keeps the last 32 messages (the startup ring) and replays them, in order, into that sink; after the first attach nothing is kept, so memory stays bounded whether or not a sink ever attaches.
Like the rest of Runtime it is called from the update loop; work off the loop posts from its Then (which gets a Ctx).
func (*UI) Attach ¶ added in v0.4.0
Attach makes s the sink every later message goes to and returns the one it replaces (nil for none). The first attach of the runtime's life replays the startup ring into s and drops it. Attach(nil) detaches: messages are discarded from then on.
func (*UI) ClearNotice ¶ added in v0.4.0
ClearNotice takes back the notice Notify returned id for.
func (*UI) Close ¶ added in v0.4.0
func (u *UI) Close()
Close keeps everything: the UI lives as long as the runtime.
func (*UI) Error ¶ added in v0.31.0
Error sets the status line to an error, drawn "Error: TEXT" in the error style until the next key; "" clears it. Use it for what failed and was not returned as a Failed result (a background refresh, a daemon event).
func (*UI) HandleMessage ¶ added in v0.4.0
HandleMessage: the UI does no off-loop work.
func (*UI) Info ¶ added in v0.31.0
Info sets the status line to a plain message ("copied 3 rows", "queued"), drawn without the error style before the hints until the next key; "" clears it.
func (*UI) Notify ¶ added in v0.4.0
Notify posts a persistent notice and returns its id for ClearNotice.
func (*UI) PendingCommand ¶ added in v0.4.0
PendingCommand: nothing is ever scheduled.
type UIMessage ¶ added in v0.4.0
type UIMessage struct {
Kind string `json:"kind"`
ID NoticeID `json:"id,omitempty"`
Text string `json:"text,omitempty"`
}
UIMessage is one thing a handler told the user: a notice (Kind notice, ID and Text), the clearing of one (Kind clear, ID), or the status line in its error tone (Kind status, Text) or its neutral tone (Kind info, Text); "" clears the line. The startup ring, a call's Response.Messages and RecordingSink hold these.
type UISink ¶ added in v0.4.0
type UISink interface {
// Notify shows a persistent notice until ClearNotice(id) or the host
// clears it.
Notify(id NoticeID, text string)
// ClearNotice takes back a notice; an unknown id is ignored.
ClearNotice(id NoticeID)
// Status replaces the one-line status with an error ("" clears it):
// what Ctx.Error posts (UIError). Only the error tone reaches it.
Status(text string)
// Info replaces the one-line status with plain text ("" clears it):
// what Ctx.Info posts (UIInfo).
Info(text string)
}
UISink is how a host shows what handlers tell the user: the Model puts notices in the footer and the status in the status line, the CLI shell prints them on stderr, a test records them. Handlers never reach the sink: they post through Ctx (ctx.Notify, ctx.ClearNotice, ctx.Error, ctx.Info) or Runtime.UI, and the host decides how it looks. Every sink shows both tones of the status line, so a plain message is never drawn as an error for want of a method. A sink that wraps another forwards every message (UIMessage.Apply does it).
type VerbCheck ¶ added in v0.43.0
VerbCheck is one check on a verb. Name identifies it (a second check of the same name replaces the first); Check reads the request's context and arguments and returns a Verdict. Checks run in the order they were added; the first that does not allow decides.
type Verbatim ¶ added in v0.34.0
type Verbatim string
Verbatim is a result a CLI prints as its text, unquoted (a file the verb writes: bindings defaults); over JSON it is a string.
type Verdict ¶ added in v0.43.0
Verdict is a check's answer: the zero Verdict allows; Ask holds the question the confirm modal asks before the verb runs; Refuse holds the reason the request fails with.
type Watch ¶ added in v0.53.0
type Watch struct {
// contains filtered or unexported fields
}
Watch is one watch of a noun's things (Runtime.Watch, the watch verb). Its methods run on the runtime's loop, like the runtime's own.
func (*Watch) Hash ¶ added in v0.53.0
Hash is a fallback watch's list hash now (the since that resumes from here), "" for a store's Watch.
func (*Watch) MarshalJSON ¶ added in v0.53.0
MarshalJSON is the watch as one value, for a caller that cannot stream: the events so far as an array; the watch ends.
func (*Watch) Stop ¶ added in v0.53.0
func (w *Watch) Stop()
Stop ends the watch (a store Watch's stop runs once); events after it are dropped.
func (*Watch) Stopped ¶ added in v0.53.0
Stopped reports whether the watch ended (Stop, or a failing list).
func (*Watch) Take ¶ added in v0.53.0
func (w *Watch) Take() []WatchEvent
Take answers the queued events (a watch without a callback) and empties the queue.
type WatchEvent ¶ added in v0.53.0
type WatchEvent struct {
Type string `json:"type"`
ID string `json:"id"`
Thing map[string]any `json:"thing,omitempty"`
Hash string `json:"hash,omitempty"`
}
WatchEvent is one change to a watched thing: its type, its key (id, "" for a singleton) and the thing as get answers it (every prop but the secret ones). A deleted thing carries its last record when the watch saw it, else none. Hash is the since a later watch resumes from: a fallback watch's list hash after the change, or what a store's Watch sets.
type WatchQuery ¶ added in v0.53.0
WatchQuery is what a store's Watch handler is asked for: one thing (Key) or the things whose props equal Where (typed by their props; empty for every thing), from Since ("" for now: the store chooses whether to send the current things first).
type WatchVersions ¶ added in v0.53.0
type WatchVersions interface {
ReadVersion(scope, hash string) (ids, hashes []string, ok bool)
WriteVersion(scope, hash string, ids, hashes []string) error
}
WatchVersions keeps the versions a fallback watch resumes from (since): per scope (a noun and its query), a version's sorted ids and their record hashes under the list hash. A version that is gone answers ok false.
Source Files
¶
- action_names.go
- actions.go
- alias_shadow.go
- args_form.go
- binding_check.go
- binding_settings.go
- bindings.go
- bindings_file.go
- block.go
- chooser.go
- chooser_sources.go
- chrome.go
- cli.go
- completion.go
- completion_list.go
- config_export.go
- config_reload.go
- configuration.go
- confirm.go
- default_bindings.go
- delivery.go
- deprecated.go
- detail.go
- docs_reference.go
- editing.go
- editor.go
- editor_block.go
- editor_keys.go
- focus.go
- focus_display.go
- foreground.go
- help.go
- help_modes.go
- help_views.go
- history.go
- history_store.go
- input.go
- input_readonly.go
- instance.go
- introspect.go
- jsonc.go
- key_echo.go
- layout.go
- list.go
- list_delta.go
- list_filter.go
- list_motions.go
- list_visual.go
- macros.go
- modal_anchor.go
- mode_badge.go
- model.go
- motion_scroll.go
- namespace.go
- noun.go
- noun_places.go
- page_hide.go
- pages.go
- palette.go
- palette_choices.go
- palette_editing.go
- palette_nouns.go
- palette_parse.go
- palette_results.go
- panes.go
- params.go
- path_chooser.go
- picker.go
- picker_preview.go
- picker_search.go
- picker_stats.go
- picker_view.go
- props.go
- query.go
- record_editor.go
- registers.go
- resolve.go
- rows_format.go
- runtime.go
- scheme.go
- search_case.go
- search_match.go
- segment.go
- segment_view.go
- set_complete.go
- set_line.go
- setting_verbs.go
- settings.go
- settings_defaults.go
- settings_owners.go
- settings_page_layout.go
- settings_review.go
- settings_session.go
- settings_view.go
- standard_derived.go
- standard_grammar.go
- standard_undo.go
- standard_verbs.go
- standard_watch.go
- subjects.go
- surface.go
- table.go
- table_cells.go
- table_columns.go
- table_fit.go
- table_pins.go
- table_state.go
- terminal.go
- text_view.go
- theme.go
- ticker.go
- timeline.go
- timeline_steps.go
- tone.go
- transport.go
- tree.go
- tree_zoom.go
- ui.go
- verb_checks.go
- yank_api.go
- yank_history.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cli is the generic command line of an ochazuke application: the NOUN VERB shell over a runtime (Shell), the oden mount that makes every noun a command of the bin (Mount) and the catalog answer that describes the runtime as JSON (Catalog).
|
Package cli is the generic command line of an ochazuke application: the NOUN VERB shell over a runtime (Shell), the oden mount that makes every noun a command of the bin (Mount) and the catalog answer that describes the runtime as JSON (Catalog). |
|
inspect
Package inspect merges ochazuke tool catalogs (the JSON BIN catalog prints) into one model and writes it as a self-contained HTML page for browsing nouns, verbs, key rows, user actions, relations and, when annotations are given, the verbs someone suggested adding (the Gaps view).
|
Package inspect merges ochazuke tool catalogs (the JSON BIN catalog prints) into one model and writes it as a self-contained HTML page for browsing nouns, verbs, key rows, user actions, relations and, when annotations are given, the verbs someone suggested adding (the Gaps view). |
|
cmd
|
|
|
charmrefs
command
Command charmrefs writes docs/CHARM-INVENTORY.md: for every project listed in docs/charm-refs.txt, the Charm (charm.land, charmbracelet) modules it depends on, how many files import each package, its entry points, and its agent docs.
|
Command charmrefs writes docs/CHARM-INVENTORY.md: for every project listed in docs/charm-refs.txt, the Charm (charm.land, charmbracelet) modules it depends on, how many files import each package, its entry points, and its agent docs. |
|
codemap
command
Command codemap writes docs/CODEMAP.md: one entry per Go file in the root package and in each importable subpackage (cli/, grid/), listing what each file declares and which sibling files it leans on.
|
Command codemap writes docs/CODEMAP.md: one entry per Go file in the root package and in each importable subpackage (cli/, grid/), listing what each file declares and which sibling files it leans on. |
|
docgen
command
Command docgen generates the offline reference linked from the architecture guide: docs/{actions,bindings,api,transport}.html, and with -ref DIR the Markdown reference of the framework runtime (refdoc: README.md, settings.md, bindings.md) that TestReference holds to the catalog.
|
Command docgen generates the offline reference linked from the architecture guide: docs/{actions,bindings,api,transport}.html, and with -ref DIR the Markdown reference of the framework runtime (refdoc: README.md, settings.md, bindings.md) that TestReference holds to the catalog. |
|
ochazuke
command
|
|
|
renamekeys
command
Command renamekeys rewrites operation keys from one spelling to the other across the repository's .go, .json, .md and .html files.
|
Command renamekeys rewrites operation keys from one spelling to the other across the repository's .go, .json, .md and .html files. |
|
Package explore explores an ochazuke application's interaction states by pressing keys, checks properties in every state it reaches, and reports bad and impossible states and actions with the shortest key path to each.
|
Package explore explores an ochazuke application's interaction states by pressing keys, checks properties in every state it reaches, and reports bad and impossible states and actions with the shortest key path to each. |
|
Package grid is a two-dimensional cursor component for ochazuke: a header and rows the application owns, a cursor and viewport in two axes, a visual selection in three shapes plus marks, and one instance per focused cell, parented to a row instance, parented to a column instance, parented to the grid, so the cell, row and column nouns all sit on the focus stack.
|
Package grid is a two-dimensional cursor component for ochazuke: a header and rows the application owns, a cursor and viewport in two axes, a visual selection in three shapes plus marks, and one instance per focused cell, parented to a row instance, parented to a column instance, parented to the grid, so the cell, row and column nouns all sit on the focus stack. |
|
internal
|
|
|
demo
Package demo is the runnable example behind `ochazuke run`: seven pages, nested draft modals, the picker and the keyboard guide, built only from the public API.
|
Package demo is the runnable example behind `ochazuke run`: seven pages, nested draft modals, the picker and the keyboard guide, built only from the public API. |
|
Package keytest drives Bubble Tea models from tests using the key names that bindings use ("ctrl+c", "esc", "enter", "shift+tab", "alt+b", "space", "x").
|
Package keytest drives Bubble Tea models from tests using the key names that bindings use ("ctrl+c", "esc", "enter", "shift+tab", "alt+b", "space", "x"). |
|
Package markdown renders Markdown with Charm's Glamour and edits its task lists in place.
|
Package markdown renders Markdown with Charm's Glamour and edits its task lists in place. |
|
cliview
Package cliview is the "markdown" detail kind of a mounted data page (cli.CatalogDetail.Kind): an editable markdown.Doc over the file the selected row's PathField names.
|
Package cliview is the "markdown" detail kind of a mounted data page (cli.CatalogDetail.Kind): an editable markdown.Doc over the file the selected row's PathField names. |
|
Package refdoc builds the generated reference of an ochazuke application: a Model of its settings and default key rows, a catalog Fingerprint over it, the Markdown pages Render writes from it (each with a header naming the build it came from), and Check, which compares those pages with the committed ones.
|
Package refdoc builds the generated reference of an ochazuke application: a Model of its settings and default key rows, a catalog Fingerprint over it, the Markdown pages Render writes from it (each with a header naming the build it came from), and Check, which compares those pages with the committed ones. |
|
Package story is o-story's engine: a story is data (a synthetic page, a script of events, an expectation), Build turns it into a live runtime and model, a Driver plays events against it headless, and a Recorder turns the messages of a live session into the same events.
|
Package story is o-story's engine: a story is data (a synthetic page, a script of events, an expectation), Build turns it into a live runtime and model, a Driver plays events against it headless, and a Recorder turns the messages of a live session into the same events. |
|
Package strictcheck fails an application's tests when its code uses a name ochazuke has deprecated.
|
Package strictcheck fails an application's tests when its code uses a name ochazuke has deprecated. |
|
Package sysstat samples the machine for status segments: CPU busy percent, memory used and total, and free disk space at a path, on macOS and Linux, without cgo.
|
Package sysstat samples the machine for status segments: CPU busy percent, memory used and total, and free disk space at a path, on macOS and Linux, without cgo. |
