commands

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package commands implements the CLI subcommands for the tt tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edit

type Edit struct {
	Date types.Date `arg:"-d,--date" help:"the date to list time entries for" default:"today"`
}

func (*Edit) Run

func (s *Edit) Run(ctx context.Context, config *config.Config) error

type List

type List struct {
	Date     types.Date         `arg:"-d,--date" help:"the date to list time entries for" default:"today"`
	Customer timeentry.Customer `arg:"-c,--customer" help:"list only time entries for the given customer"`
}

func (*List) Run

func (l *List) Run(_ context.Context, config *config.Config) error

type Report

type Report struct {
	// Specify the range positionally
	Start *types.Date `arg:"positional" help:"specify the start of the reporting range (defaults to the beginning of last month)"`
	End   *types.Date `arg:"positional" help:"specify the end of the reporting range (defaults to the end of last month)"`

	// Specify the range using shorthand
	Month     types.Month `` /* 146-byte string literal not displayed */
	Year      int         `arg:"-y,--year" help:"shorthand for reporting over an entire year (can be combined with --month)"`
	Today     bool        `arg:"--today" help:"shorthand for reporting on today"`
	Yesterday bool        `arg:"--yesterday" help:"shorthand for reporting on yesterday"`
	ThisWeek  bool        `arg:"--thisweek" help:"shorthand for reporting on the current week (Sunday-today)"`
	LastWeek  bool        `arg:"--lastweek" help:"shorthand for reporting on last week (Sunday-Saturday)"`
	ThisMonth bool        `arg:"--thismonth" help:"shorthand for reporting on the current month"`
	LastMonth bool        `arg:"--lastmonth" help:"shorthand for reporting on last month"`
	ThisYear  bool        `arg:"--thisyear" help:"shorthand for reporting on the current year"`
	LastYear  bool        `arg:"--lastyear" help:"shorthand for reporting on last year"`

	// Specify the grains to show
	TaskGrain          bool `arg:"--taskgrain" help:"report on the task grain"`
	NoTaskGrain        bool `arg:"--no-taskgrain" help:"do not report on the task grain"`
	DescriptionGrain   bool `arg:"--descriptiongrain" help:"report on the task grain"`
	NoDescriptionGrain bool `arg:"--no-descriptiongrain" help:"do not report on the task grain"`

	// Narrow the set of time entries to report on
	Customer timeentry.Customer `arg:"-c,--customer" help:"customer ID to generate a report for"`
	Project  timeentry.Project  `arg:"-p,--project" help:"project name to generate a report for"`

	// How to sort the report
	Sort Sort `arg:"-s,--sort" help:"the grain to sort the report by (alphabetical,alpha,a or time-spent,time,t)" default:"time-spent"`
	Desc bool `arg:"--desc" help:"sort descending"`
	Asc  bool `arg:"--asc" help:"sort ascending"`

	// Output file
	OutputFile types.Filename `` /* 174-byte string literal not displayed */
}

func (*Report) Run

func (r *Report) Run(ctx context.Context, config *config.Config) error

type Resume

type Resume struct {
	Entry       int         `arg:"-n,--entry" help:"entry number to resume (negative counts from end: -1=last, -2=second-to-last)" default:"-1"`
	Description *string     `` /* 127-byte string literal not displayed */
	Start       *types.Time `arg:"-s,--start" help:"the start time of the resumed time entry" default:"now"`
}

func (*Resume) Run

func (s *Resume) Run(ctx context.Context, config *config.Config) error

type Sort

type Sort int
const (
	SortAlphabetical Sort = iota
	SortTimeSpent
)

func (*Sort) UnmarshalText

func (s *Sort) UnmarshalText(b []byte) error

type Start

type Start struct {
	Description string                  `arg:"positional" placeholder:"DESC" help:"the descripiton of the time entry"`
	Start       *types.Time             `arg:"-s,--start" help:"the start time of the time entry" default:"now"`
	Type        timeentry.TimeEntryType `arg:"-t,--type" help:"the type of the time entry"`
	Project     timeentry.Project       `arg:"-p,--project" help:"the project of the time entry"`
	Customer    timeentry.Customer      `arg:"-c,--customer" help:"the customer of the time entry"`
	TaskID      timeentry.TaskID        `arg:"-i,--taskid" help:"the task ID of the time entry"`
}

func (*Start) Run

func (s *Start) Run(ctx context.Context, config *config.Config) error

type Stop

type Stop struct {
	Stop *types.Time `arg:"-s,--stop" help:"the time at which to stop the current time entry" default:"now"`
}

func (*Stop) Run

func (s *Stop) Run(ctx context.Context, config *config.Config) error

type Sync

type Sync struct {
	Month *types.Month `` /* 135-byte string literal not displayed */
}

func (*Sync) Run

func (s *Sync) Run(ctx context.Context, cfg *config.Config) error

Jump to

Keyboard shortcuts

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