cli

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package cli provides the command-line interface for dayplan.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddCommand

type AddCommand struct {
	Category string `short:"c" long:"category" description:"the category of the added event(s)" value-name:"<category>" required:"true"`
	Name     string `short:"n" long:"name" description:"the name of the added event(s)" value-name:"<name>" required:"true"`

	Start string `short:"s" long:"start" description:"the time at which the event begins" value-name:"<TIME>" required:"true"`
	End   string `short:"e" long:"end" description:"the time at which the event ends" value-name:"<TIME>" required:"true"`

	RepeatInterval string `` /* 193-byte string literal not displayed */
	RepeatTil      string `` /* 149-byte string literal not displayed */
}

AddCommand contains flags for the `summarize` command line command, for `go-flags` to parse command line args into.

func (*AddCommand) Execute

func (command *AddCommand) Execute(args []string) error

Execute executes the add command. (This gets called by `go-flags` when `add` is provided on the command line)

type CommandLineOpts

type CommandLineOpts struct {
	Version bool `short:"v" long:"version" description:"Show the program version"`

	TuiCommand       TUICommand       `command:"tui" subcommands-optional:"true"`
	SummarizeCommand SummarizeCommand `command:"summarize" subcommands-optional:"true"`
	TimesheetCommand TimesheetCommand `command:"timesheet" subcommands-optional:"true"`
	AddCommand       AddCommand       `command:"add" subcommands-optional:"true"`
	VersionCommand   VersionCommand   `command:"version" subcommands-optional:"true"`
}
var Opts CommandLineOpts

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the struct for the TUI controller.

func NewController

func NewController(
	date model.Date,
	envData control.EnvData,
	categoriesByName map[model.CategoryName]*model.Category,
	stylesheet styling.Stylesheet,
	weatherHandler *weather.Handler,
	suntimesProvider provider.SunTimesProvider,
) (*Controller, error)

NewController creates a new Controller.

func (*Controller) DeleteCurrentTask added in v0.10.0

func (c *Controller) DeleteCurrentTask()

func (*Controller) RemoveCurrentEvent added in v0.10.2

func (c *Controller) RemoveCurrentEvent()

func (*Controller) Run

func (c *Controller) Run()

Run ...

func (*Controller) ScheduleCurrentTaskNow added in v0.10.0

func (c *Controller) ScheduleCurrentTaskNow()

func (*Controller) ScrollBacklogToBottom added in v0.10.0

func (c *Controller) ScrollBacklogToBottom()

func (*Controller) ScrollBacklogToTop added in v0.10.0

func (c *Controller) ScrollBacklogToTop()

func (*Controller) ScrollBottom

func (c *Controller) ScrollBottom()

ScrollBottom scrolls the main timeline view to the bottom.

func (*Controller) ScrollDown

func (c *Controller) ScrollDown(by int)

ScrollDown scrolls the main timeline view down by the given number of rows.

func (*Controller) ScrollTop

func (c *Controller) ScrollTop()

ScrollTop scrolls the main timeline view to the top.

func (*Controller) ScrollUp

func (c *Controller) ScrollUp(by int)

ScrollUp scrolls the main timeline view up by the given number of rows.

func (*Controller) StepIntoCurrentTaskSubtasks added in v0.10.0

func (c *Controller) StepIntoCurrentTaskSubtasks()

type SummarizeCommand

type SummarizeCommand struct {
	From time.Time `short:"f" long:"from" description:"the timestamp from which to start summarizing" value-name:"<TIME>" required:"true"`
	Til  time.Time `short:"t" long:"til" description:"the timestamp until which to summarize" value-name:"<TIME>" required:"true"`

	HumanReadable        bool   `long:"human-readable" description:"format times as hours and minutes"`
	CategoryFilterString string `` /* 147-byte string literal not displayed */

	Verbose bool `short:"v" long:"verbose" description:"provide verbose output"`
}

Flags for the `summarize` command line command, for `go-flags` to parse command line args into.

func (*SummarizeCommand) Execute

func (command *SummarizeCommand) Execute(args []string) error

Executes the summarize command. (This gets called by `go-flags` when `summarize` is provided on the command line)

type TUICommand added in v0.9.11

type TUICommand struct {
	Day           string `short:"d" long:"day" description:"Specify the day to plan" value-name:"<file>"`
	Theme         string `` /* 196-byte string literal not displayed */
	LogOutputFile string `short:"l" long:"log-output-file" description:"specify a log output file (otherwise logs dropped)"`
	LogPretty     bool   `short:"p" long:"log-pretty" description:"prettify logs to file"`
	LogLevel      string `long:"log-level" description:"set log level to 'trace', 'debug', 'info', 'warn', 'error'"`
}

TUICommand is the struct for the TUI command.

func (*TUICommand) Execute added in v0.9.11

func (command *TUICommand) Execute(_ []string) error

Execute runs the TUI command.

type TimesheetCommand added in v0.9.0

type TimesheetCommand struct {
	FromDay string `short:"f" long:"from" description:"the day from which to start summarizing" value-name:"<yyyy-mm-dd>" required:"true"`
	TilDay  string `short:"t" long:"til" description:"the day til which to summarize (inclusive)" value-name:"<yyyy-mm-dd>" required:"true"`

	CategoryIncludeFilter string `` /* 170-byte string literal not displayed */
	CategoryExcludeFilter string `` /* 170-byte string literal not displayed */

	IncludeEmpty   bool   `long:"include-empty"`
	DateFormat     string `` /* 145-byte string literal not displayed */
	Enquote        bool   `long:"enquote" description:"add quotes around field values"`
	FieldSeparator string `long:"field-separator" value-name:"<CSV separator (default ',')>" default:","`
	DurationFormat string `long:"duration-format" option:"golang" option:"colon-delimited" default:"golang"`

	LogOutputFile string `long:"log-output-file" description:"specify a log output file (by default they go to stdout)"`
	LogPretty     bool   `long:"log-pretty" description:"prettify log messages"`
	LogLevel      string `long:"log-level" description:"set log level to 'trace', 'debug', 'info', 'warn', 'error'"`
}

TimesheetCommand is the command `timesheet`, which produces a timesheet for a given category.

A timesheet has entries per day, each of the form

<start-time>,<break-duration>,<end-time>

e.g.

08:50,45min,16:20

func (*TimesheetCommand) Execute added in v0.9.0

func (command *TimesheetCommand) Execute(args []string) error

Execute executes the timesheet command.

type UIDimensions added in v0.10.0

type UIDimensions struct {
	// contains filtered or unexported fields
}

type VersionCommand

type VersionCommand struct {
}

Flags for the `version` command line command, for `go-flags` to parse command line args into.

func (*VersionCommand) Execute

func (command *VersionCommand) Execute(args []string) error

Executes the version command. (This gets called by `go-flags` when `version` is provided on the command line)

Jump to

Keyboard shortcuts

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