timesheet

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 10 Imported by: 0

README

Build Status codecov Maintainability

go-timesheet - package for parsing the timesheet fileformat

Quick Start

go get -u github.com/gregoryv/go-timesheet/...
gensheet -h

This package contains parser and commands for manipulating timesheet files.

Let's face it, timesheets are extremely boring to fill out so I decided to fix that. Check out the timesheet fileformat, it's readable, lightweight and versatile enough to accommodate most situations.

By default the command gensheet generates an 8 hour working day timesheet already filled out, assuming you will be working each weekday. Save it, put it under version control, do what you want with it.

To summarize your timesheets use the worklog command.

Summarize one timesheet

worklog 201801.timesheet

The output summarizes all tagged values in that timesheet.

2018 January    179:30   (8:00 semester)

                       +179:30
                              8:00 semester

Expected vs. actual worked hours

worklog -origin expected/ 201801.timesheet

The output summarizes all tagged values and reported time and calculates how much overtime you have put in if any. The expected directory is assumed to contain a timesheet with the same name to compare with.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatHHMM

func FormatHHMM(dur time.Duration) string

func InParenthesis

func InParenthesis(tags []Tagged) []string

func Render

func Render(year int, month time.Month, hours int) *bytes.Buffer

func RenderTo added in v0.3.0

func RenderTo(w io.Writer, year int, month time.Month, hours int)

Types

type ByTag

type ByTag []Tagged

func (ByTag) Len

func (by ByTag) Len() int

func (ByTag) Less

func (by ByTag) Less(i, j int) bool

func (ByTag) Swap

func (by ByTag) Swap(i, j int)

type Report

type Report struct {
	Sheets []Sheet
	// contains filtered or unexported fields
}

func NewReport

func NewReport() *Report

func (*Report) Append

func (r *Report) Append(sheet *Sheet) (sheetCount int, err error)

func (*Report) FindByPeriod

func (r *Report) FindByPeriod(period string) (*Sheet, error)

func (*Report) Reported

func (r *Report) Reported() time.Duration

func (*Report) Tags

func (r *Report) Tags() []Tagged

Tags returns a sorted and summarized list of tags

type Sheet

type Sheet struct {
	Period   string // Year Month
	Reported Tagged
	Tags     []Tagged
}

func Load

func Load(filepath string) (sheet *Sheet, err error)

func NewSheet

func NewSheet() *Sheet

func Parse

func Parse(body []byte) (sheet *Sheet, err error)

func (*Sheet) String

func (sheet *Sheet) String() string

type Tagged

type Tagged struct {
	Duration time.Duration
	Tag      string
}

func SumTagged

func SumTagged(body []byte) (tags []Tagged, err error)

func (Tagged) String

func (tagged Tagged) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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