Documentation
¶
Overview ¶
Package tui provides Taskronin's terminal user interface through the client API.
Index ¶
Constants ¶
const DefaultPollInterval = 5 * time.Second
DefaultPollInterval is the dashboard refresh interval (A§14 D25).
Variables ¶
var ErrUsage = errors.New("usage")
ErrUsage identifies invalid launch options before the terminal is opened.
Functions ¶
Types ¶
type API ¶
type API interface {
Clock(ctx context.Context) (*api.Clock, error)
Generation(ctx context.Context) (string, error)
RefreshGeneration(ctx context.Context) (string, error)
Today(ctx context.Context, ifNoneMatch string) (t *api.Today, etag string, notModified bool, err error)
Day(ctx context.Context, d civil.Date) (*api.Day, error)
Upcoming(ctx context.Context) (*api.Upcoming, error)
Search(ctx context.Context, q client.SearchQuery) (*api.Page[api.SearchHit], error)
ListTasks(ctx context.Context, q client.TaskQuery) (*api.Page[api.Task], error)
GetTask(ctx context.Context, id int64) (*api.TaskDetail, error)
TaskHistory(ctx context.Context, id int64, p client.PageQuery) (*api.Page[api.EventView], error)
ListEntries(ctx context.Context, q client.EntryQuery) (*api.Page[api.Entry], error)
ListBlocks(ctx context.Context, q client.BlockQuery) ([]api.Block, error)
AIChanges(ctx context.Context, all bool, p client.PageQuery) (*api.AIChanges, error)
AddTask(ctx context.Context, m client.Mut, r api.AddTaskRequest) (*api.OpResponse, error)
UpdateTask(ctx context.Context, m client.Mut, id int64, r api.UpdateTaskRequest) (*api.OpResponse, error)
PlaceTask(ctx context.Context, m client.Mut, id int64, r api.PlaceRequest) (*api.OpResponse, error)
DeferTask(ctx context.Context, m client.Mut, id int64, r api.DeferRequest) (*api.OpResponse, error)
BlockTask(ctx context.Context, m client.Mut, id int64, r api.BlockRequest) (*api.OpResponse, error)
CompleteTask(ctx context.Context, m client.Mut, id int64, r api.CompleteRequest) (*api.OpResponse, error)
DropTask(ctx context.Context, m client.Mut, id int64) (*api.OpResponse, error)
AcceptNew(ctx context.Context, m client.Mut, r api.AcceptNewRequest) (*api.OpResponse, error)
AddEntry(ctx context.Context, m client.Mut, r api.AddEntryRequest) (*api.OpResponse, error)
UpdateEntry(ctx context.Context, m client.Mut, id int64, r api.UpdateEntryRequest) (*api.OpResponse, error)
RelinkEntry(ctx context.Context, m client.Mut, id int64, r api.RelinkRequest) (*api.OpResponse, error)
DeleteEntry(ctx context.Context, m client.Mut, id int64) (*api.OpResponse, error)
Reblock(ctx context.Context, m client.Mut, blockID int64, r api.ReblockRequest) (*api.OpResponse, error)
Unblock(ctx context.Context, m client.Mut, blockID int64) (*api.OpResponse, error)
SetOutcome(ctx context.Context, m client.Mut, blockID int64, r api.OutcomeRequest) (*api.OpResponse, error)
SetFocus(ctx context.Context, m client.Mut, r api.FocusRequest) (*api.OpResponse, error)
Revert(ctx context.Context, m client.Mut, opID string) (*api.OpResponse, error)
Undo(ctx context.Context, m client.Mut) (*api.OpResponse, error)
Redo(ctx context.Context, m client.Mut) (*api.OpResponse, error)
ReviewAIChanges(ctx context.Context, m client.Mut, r api.ReviewRequest) (*api.OpResponse, error)
}
API is the subset of client.Client used by the terminal user interface.
type App ¶
type App struct {
// contains filtered or unexported fields
}
App owns the terminal UI. Only Update and its helpers change model state.
type Config ¶
type Config struct {
API API
Ctx context.Context
Clock api.Clock
StartTab Tab
StartMode Mode
RecapDate civil.Date
PollInterval time.Duration
Color bool
Editor EditorEnv
}
Config supplies the app's client, server clock and launch options.
type EditorEnv ¶
type EditorEnv struct {
Setting string
Getenv func(string) string
DraftsDir string
Exec func(*exec.Cmd, tea.ExecCallback) tea.Cmd
}
EditorEnv supplies editor configuration and the process runner.
type RunOptions ¶
type RunOptions struct {
API API
StartTab Tab
StartMode Mode
RecapSpec string // Past-mode date only; empty means today.
Color bool
Editor EditorEnv
In io.Reader
Out io.Writer
}
RunOptions supplies the client, initial view and terminal dependencies.