tracker

package
v0.0.0-...-abf2116 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LongDateFormat = "Monday 02 Jan 2006"
	DateTimeFormat = "02.01.2006 15:04"
	TimeFormat     = "15:04"
	DateFormat     = "2006-01-02"
)

Variables

View Source
var DateLocation = time.Now().Location()
View Source
var DefaultConfig = []byte(`
[core]
editor = "vim"

[colors]
enabled = true

[log]
defaultStartDate = -14
defaultEndDate = 0

[backend]
token = ""
url = ""
user = ""
autoAddWorkLog = false
`)

Functions

func EditConfig

func EditConfig() error

func Log

func Log(q FramesQuery, oneLine bool, verbose bool, quiet bool)

func Report

func Report(q FramesQuery)

func SetConfig

func SetConfig(key string, value interface{})

func WriteConfigToFile

func WriteConfigToFile() error

Types

type Config

type Config struct {
	Core struct {
		Editor string
	}

	Colors struct {
		Enabled bool
	}

	Log struct {
		DefaultStartDate int
		DefaultEndDate   int
	}

	Backend struct {
		Token          string
		Url            string
		User           string
		AutoAddWorkLog bool
	}
}

type EditFrameOpts

type EditFrameOpts struct {
	UUID     string
	Position int
}

type Frame

type Frame struct {
	Start    time.Time
	End      time.Time
	Project  string
	Tags     []string
	Uuid     string
	LastEdit time.Time
	Comment  string
	Synced   bool
}

func EditFrame

func EditFrame(opts EditFrameOpts) (Frame, error)

func NewFrame

func NewFrame(p string, t []string) Frame

func (*Frame) AddWorkLog

func (f *Frame) AddWorkLog()

func (Frame) Duration

func (f Frame) Duration() TrackerDuration

func (Frame) Equals

func (f Frame) Equals(other Frame) bool

func (Frame) Finished

func (f Frame) Finished() bool

func (Frame) FormattedEndTime

func (f Frame) FormattedEndTime() string

func (Frame) FormattedProject

func (f Frame) FormattedProject() string

func (Frame) FormattedStartTime

func (f Frame) FormattedStartTime() string

func (Frame) FormattedTags

func (f Frame) FormattedTags() string

func (Frame) InProgress

func (f Frame) InProgress() bool

func (*Frame) MarshalJSON

func (f *Frame) MarshalJSON() ([]byte, error)

func (Frame) RelativeTime

func (f Frame) RelativeTime() string

func (*Frame) UnmarshalJSON

func (f *Frame) UnmarshalJSON(data []byte) error

type Frames

type Frames []Frame

func GetFrames

func GetFrames() Frames

func GetFramesFiltered

func GetFramesFiltered(q FramesQuery) Frames

func (Frames) ByPosition

func (f Frames) ByPosition(pos int) (int, Frame)

func (Frames) ByUUID

func (f Frames) ByUUID(uuid string) (int, Frame)

func (Frames) Frames

func (f Frames) Frames() []string

func (Frames) Len

func (f Frames) Len() int

func (Frames) Less

func (f Frames) Less(i, j int) bool

func (Frames) MaxDate

func (f Frames) MaxDate() time.Time

func (*Frames) Merge

func (f *Frames) Merge(other Frames) (int, int)

func (Frames) MinDate

func (f Frames) MinDate() time.Time

func (Frames) Persist

func (f Frames) Persist()

func (Frames) Projects

func (f Frames) Projects() []string

func (Frames) Swap

func (f Frames) Swap(i, j int)

func (Frames) Tags

func (f Frames) Tags() []string

type FramesQuery

type FramesQuery struct {
	Projects map[string]struct{}
	Tags     map[string]struct{}
	From     time.Time
	To       time.Time
}

func NewFrameQuery

func NewFrameQuery(projects, tags []string, from, to string) (FramesQuery, error)

type TrackerDuration

type TrackerDuration struct {
	time.Duration
}

func (TrackerDuration) String

func (t TrackerDuration) String() string

Jump to

Keyboard shortcuts

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