cli

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

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"`

	Date  string `short:"d" long:"date" description:"the date of the (first) event" value-name:"<yyyy-mm-dd>" required:"true"`
	Start string `short:"s" long:"start" description:"the time at which the event begins" value-name:"<HH:MM>" required:"true"`
	End   string `short:"e" long:"end" description:"the time at which the event ends" value-name:"<HH:MM>" 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 {
	FileHandlers map[model.Date]*storage.FileHandler
	// contains filtered or unexported fields
}

Controller is the struct for the TUI controller.

func NewController

func NewController(
	date model.Date,
	envData control.EnvData,
	categoryStyling styling.CategoryStyling,
	stylesheet styling.Stylesheet,
) (*Controller, error)

NewController creates a new Controller.

func (*Controller) Run

func (t *Controller) Run()

Run

func (*Controller) ScrollBottom

func (t *Controller) ScrollBottom()

func (*Controller) ScrollDown

func (t *Controller) ScrollDown(by int)

func (*Controller) ScrollTop

func (t *Controller) ScrollTop()

func (*Controller) ScrollUp

func (t *Controller) ScrollUp(by int)

type ControllerEvent

type ControllerEvent int
const (
	ControllerEventExit ControllerEvent = iota
	ControllerEventRender
	ControllerEventTaskEditorExit
	ControllerEventEventEditorExit
)

type SummarizeCommand

type SummarizeCommand 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"`

	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"`
}

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"`
}

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 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
JackTT - Gopher 🇻🇳