Documentation ¶
Index ¶
- Constants
- func CloneStrings(data []string) []string
- func FormatDate(value time.Time) string
- func FormatDateTime(value time.Time) string
- func FormatTime(value time.Time) string
- func HomeDir() string
- func ParseDateTime(value string) (time.Time, error)
- func ReadTextFile(file string) (string, error)
- func ToLocal(t time.Time) time.Time
- func WriteTextFile(dir string, file string, data string) error
- type AdjustEvent
- type AdjustPrinter
- type AdjustService
- type Analytics
- type Archiver
- type ColoredDiffPrinter
- type Config
- type DiffPrinter
- type Duration
- type PolybarPrinter
- type Printer
- type Service
- func (s *Service) Adjust(adjustments map[int]int) *TimeLogger
- func (s *Service) Archiver() *Archiver
- func (s *Service) Clear()
- func (s *Service) InstallAutocomplete()
- func (s *Service) Load() (bool, error)
- func (s *Service) PolybarPrinter(format string) Printer
- func (s *Service) Quicklist() []string
- func (s *Service) RunAdjustService()
- func (s *Service) Start(comment string)
- func (s *Service) Stop()
- func (s *Service) TextPrinter() Printer
- type TextPrinter
- type TimeLogger
- type Token
Constants ¶
const Version = "0.1.0"
Variables ¶
This section is empty.
Functions ¶
func CloneStrings ¶
CloneStrings duplicates []string in memory.
func FormatDateTime ¶
FormatDateTime formats datetime to string.
func ParseDateTime ¶
ParseDateTime parses time in app-default format.
func ReadTextFile ¶
ReadTextFile reads text file from given.
Types ¶
type AdjustEvent ¶
type AdjustEvent struct {
// contains filtered or unexported fields
}
AdjustEvent sent when adjusting minutes.
type AdjustPrinter ¶
type AdjustPrinter struct {
// contains filtered or unexported fields
}
AdjustPrinter - stdout printer.
func (*AdjustPrinter) Print ¶
func (p *AdjustPrinter) Print()
Print adjust lines for timelog to stdout.
func (AdjustPrinter) String ¶
func (p AdjustPrinter) String() string
String returns text representation of timelog.
type AdjustService ¶
type AdjustService struct {
// contains filtered or unexported fields
}
AdjustService data.
func (*AdjustService) Run ¶
func (p *AdjustService) Run(success func())
Run handles the service logic.
type Analytics ¶
type Analytics struct { EntryNum int Duration LastDuration Duration PrefixDuration map[string]Duration PrefixOrder []string }
Analytics for timelog.
type ColoredDiffPrinter ¶
type ColoredDiffPrinter struct {
// contains filtered or unexported fields
}
ColoredDiffPrinter - timelogger diff printer with color.
func (*ColoredDiffPrinter) Print ¶
func (p *ColoredDiffPrinter) Print()
Print outputs timelog diff to stdout.
func (*ColoredDiffPrinter) String ¶
func (p *ColoredDiffPrinter) String() string
String returns colored diff representation of two timelogs.
type DiffPrinter ¶
type DiffPrinter struct {
// contains filtered or unexported fields
}
DiffPrinter - timelogger diff printer.
func (*DiffPrinter) String ¶
func (p *DiffPrinter) String() string
String returns diff representation of timelog.
type Duration ¶
func (Duration) TotalString ¶
type PolybarPrinter ¶
type PolybarPrinter struct {
// contains filtered or unexported fields
}
PolybarPrinter - timelogger formatted for polybar output.
func (*PolybarPrinter) Print ¶
func (p *PolybarPrinter) Print()
Print outputs timelog diff to stdout.
func (*PolybarPrinter) String ¶
func (p *PolybarPrinter) String() string
String returns colored diff representation of two timelogs.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides timeloggin functionallity and syncs data to files.
func NewService ¶
func NewService(timelogger *TimeLogger) *Service
NewService creates timelog service.
func (*Service) Adjust ¶
func (s *Service) Adjust(adjustments map[int]int) *TimeLogger
Adjust timelog.
func (*Service) InstallAutocomplete ¶
func (s *Service) InstallAutocomplete()
InstallAutocomplete saves sh files to config dir with autcomplete.
func (*Service) PolybarPrinter ¶
PolybarPrinter returns default stdout printer.
func (*Service) RunAdjustService ¶
func (s *Service) RunAdjustService()
RunAdjustService runs adjust subservice.
func (*Service) TextPrinter ¶
TextPrinter returns default stdout printer.
type TextPrinter ¶
type TextPrinter struct {
// contains filtered or unexported fields
}
TextPrinter - stdout printer.
func (*TextPrinter) String ¶
func (p *TextPrinter) String() string
String returns text representation of timelog.
type TimeLogger ¶
type TimeLogger struct {
// contains filtered or unexported fields
}
TimeLogger data.
func NewTimeLogger ¶
func NewTimeLogger(c *Config) *TimeLogger
NewTimeLogger creates new time logger.
func (*TimeLogger) Adjust ¶
func (t *TimeLogger) Adjust(adjustments map[int]int) *TimeLogger
Adjust takes adjustments map and applies time modifications based on provided values in minutes.
func (*TimeLogger) Start ¶
func (t *TimeLogger) Start(comment string)
Start appends new time log entry closing last unclosed entry.
func (*TimeLogger) Tokenize ¶
func (t *TimeLogger) Tokenize(split bool) []Token
Tokenize generate list of tokens of how timelog output can be split.