cmd

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package cmd implements the toggl-cli commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath added in v0.4.0

func ConfigPath() (string, error)

ConfigPath returns the config file to use: the first existing candidate, or the preferred XDG path for new installs.

func Execute

func Execute(ctx context.Context) error

Execute runs the command line with ctx, which every command passes on to its API requests. Cobra has already printed the returned error.

func NewRootCmd added in v0.25.0

func NewRootCmd() *cobra.Command

NewRootCmd builds the toggl-cli command tree. Each call has its own configuration and flags, so a tree can be built and run independently of any other.

Types

type ContinueService added in v0.23.0

type ContinueService interface {
	CreateTimeEntry(ctx context.Context, workspaceID int, entry api.TimeEntry) (*api.TimeEntry, error)
}

ContinueService is the subset of api.Client used by the continue command.

type EditService added in v0.18.0

type EditService interface {
	EntryLookup
	ProjectIDByName(ctx context.Context, workspaceID int, projectName string) (int, error)
	UpdateTimeEntry(ctx context.Context, workspaceID int, entryID int, entry api.TimeEntry) (*api.TimeEntryItem, error)
	ProjectNames(ctx context.Context, workspaceID int, needed ...int) (map[int]string, error)
}

EditService is the subset of api.Client used by the edit command.

type EntryLookup added in v0.25.0

type EntryLookup interface {
	TimeEntries(ctx context.Context, from, to *time.Time) ([]api.TimeEntryItem, error)
	TimeEntry(ctx context.Context, id int) (*api.TimeEntryItem, error)
}

EntryLookup is the subset of api.Client used to pick the entry a command acts on.

type HistoryEntry added in v0.6.0

type HistoryEntry struct {
	Description string
	Duration    int
	Project     string
}

HistoryEntry is one row of the history summary: the total duration logged for a description and project.

type ProjectConfig added in v0.8.0

type ProjectConfig struct {
	Paths []string `mapstructure:"paths"`
	// TicketPattern overrides the global ticket pattern for this project.
	TicketPattern string `mapstructure:"ticket_pattern"`
}

ProjectConfig holds project path mappings from config.

type ProjectsListService added in v0.25.0

type ProjectsListService interface {
	Projects(ctx context.Context, workspaceID int) ([]api.Project, error)
	RefreshProjects(ctx context.Context, workspaceID int) ([]api.Project, error)
}

ProjectsListService is the subset of api.Client used by the projects list command.

type StartService added in v0.17.0

type StartService interface {
	ProjectIDByName(ctx context.Context, workspaceID int, projectName string) (int, error)
	CreateTimeEntry(ctx context.Context, workspaceID int, entry api.TimeEntry) (*api.TimeEntry, error)
	ProjectNames(ctx context.Context, workspaceID int, needed ...int) (map[int]string, error)
}

StartService is the subset of api.Client used by the start command.

Jump to

Keyboard shortcuts

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