home

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package home composes the cockpit's home and decision queues from the profile's views, the decisions each task waits on and the words of the profile and its plugins.

Index

Constants

View Source
const (
	ActionGate   = "gate"   // resolve the item's gate with the intent ID
	ActionAction = "action" // run the catalog action ID on the item's unit
	ActionOpen   = "open"   // open the item's unit at its source
)

The kinds of a queue item's primary action.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Kind, ID string
}

Action is an item's primary action.

type Count

type Count struct {
	ID    string
	Kind  decision.Kind
	View  task.View
	N     int
	Label string
	Nouns []PluginNoun
}

Count is a counter's count and its words.

type Counter

type Counter struct {
	ID           string
	Kind         decision.Kind
	View         task.View
	Noun, Clause Forms
}

Counter counts a decision kind's decisions (Kind), one per item of its queue, or a view's tasks (View, with its own Noun and Clause).

type Decisions

type Decisions interface {
	Of(ctx context.Context, e task.Task) ([]decision.Found, error)
}

Decisions are the decisions a task waits on, as the profile maps its open gates and its units' states.

type Forms

type Forms map[string]string

Forms are a text's plural forms by CLDR category; "other" is required.

func (Forms) For

func (f Forms) For(form string) string

For is the text of category form, else the "other" text.

func (Forms) Or

func (f Forms) Or(others ...Forms) Forms

Or is f, else the first of others that holds a text.

type Home

type Home struct {
	Template    string
	Sentences   [][]Part
	Counts      []Count
	Empty       string
	Sections    []Rows
	CaptureHint string
}

Home is the briefing, the sections and the capture hint.

type Item

type Item struct {
	Task      task.Task
	Found     decision.Found
	Situation string
	Primary   Action
}

Item is one decision: a task's open gate (Found.Gate), or a state of one of its units (Found.Unit, with Situation how the unit's situation reads).

type KindWords

type KindWords struct {
	View                  task.View
	Noun, Clause          Forms
	Queue, Empty, Primary string
}

KindWords are a decision kind's view and words; Primary is the gate intent a queue offers first.

type Lists

type Lists interface {
	Sets(ctx context.Context, views []task.View, keep coretasks.Keep) (map[task.View][]task.Task, error)
}

Lists are the tasks of several views in one pass (coretasks.Service).

type Part

type Part struct {
	Text    string
	Counter int
}

Part is a sentence's text, or with Counter at least 0 the count of that index in Home.Counts.

type PluginKind

type PluginKind struct {
	Clause       Forms
	Queue, Empty string
}

PluginKind are a plugin's words of a decision kind, each empty when the kind's own stand.

type PluginNoun

type PluginNoun struct {
	Plugin unit.ProviderID
	N      int
	Noun   string
}

PluginNoun is a plugin's share of a count.

type PluginWords

type PluginWords struct {
	Noun    Forms
	Kinds   map[decision.Kind]PluginKind
	Primary map[decision.Kind]string
	// Situations are how the plugin's situations read, by situation.
	Situations map[string]string
}

PluginWords are a plugin's noun, its words of each decision kind and what its queue offers first on each.

type Profile

type Profile struct {
	Template, Join, LastJoin, End, Count, Empty string
	PerSentence                                 int
	Counters                                    []Counter
	Sections                                    []Section
	CaptureHint                                 string
}

Profile is home.toml: the briefing's words and counters, the sections and the capture hint.

type Queue

type Queue struct {
	Kind         decision.Kind
	View         task.View
	Title, Empty string
	Items        []Item
}

Queue is a decision kind's items, the oldest decision first, and View, the view its items are drawn as rows of.

type Rows

type Rows struct {
	Section
	Tasks []task.Task
	Total int
}

Rows are a section's first rows and how many it holds.

type Section

type Section struct {
	ID          string
	View        task.View
	Label, Time string
	Limit       int
}

Section is the first Limit rows of View, titled Label, each showing Time.

type Service

type Service struct {
	Lists     Lists
	Decisions Decisions
	Words     Words
}

Service composes the home and the decision queues.

func (Service) Home

func (s Service) Home(ctx context.Context) (Home, error)

Home reads every counter's and section's view in one pass and words the briefing.

func (Service) Queue

func (s Service) Queue(ctx context.Context, k decision.Kind, keep coretasks.Keep) (Queue, error)

Queue is kind k's items over the tasks of its view that keep takes (every one when nil).

type Words

type Words interface {
	Profile() Profile
	Kind(k decision.Kind) KindWords
	Plugin(p unit.ProviderID) PluginWords
	// Form is the CLDR plural category of n in the served locale.
	Form(n int) string
}

Words are the profile's and the plugins' words in the served locale.

Jump to

Keyboard shortcuts

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