merki

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 13 Imported by: 0

README

merki

$ merki --help
NAME:
   merki - Command line personal health tracker

USAGE:
   merki [global options] command [command options] [arguments...]

VERSION:
   0.0.8

COMMANDS:
     add, a             Add measurement value to the file
     sparkline, spark   Draw sparkline graph for a measure
     asciigraph, graph  Draw ascii graph for a measure
     measurements, m    Return list of all used measurements
     filter, f          Filter records for single measurement
     interval, i        Shows the interval between two measurement events
     latest, l          Show the latest values for all measurements
     help, h            Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --file value, -f value  Log file path (default: "health.log") [$MERKI_FILE]
   --help, -h              show help
   --version, -v           print the version

Documentation

Index

Constants

View Source
const (
	IntervalNone GroupingInterval = iota
	IntervalHourly
	IntervalDaily
	IntervalWeekly
	IntervalTotal

	TypeFirst GroupingType = iota
	TypeAverage
	TypeMax
	TypeMin
	TypeSum

	RoundSeconds RoundType = iota
	RoundMinutes
	RoundHours
	RoundDays
)

Variables

This section is empty.

Functions

func ParseFileCallback added in v0.0.9

func ParseFileCallback(fileName string, delimiter rune, cb ParserCallback) error

func ParseStreamCallback added in v0.0.9

func ParseStreamCallback(reader io.Reader, delimiter rune, cb ParserCallback) error

Types

type Accumulator

type Accumulator map[string][]*Record

Accumulator collects records by string key

func (*Accumulator) Add

func (a *Accumulator) Add(key string, r *Record)

Add adds record to the accumulator

func (*Accumulator) Print

func (a *Accumulator) Print(w *csv.Writer, gt GroupingType) error

Print accumulator to the writer

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(w *csv.Writer, measure string, gi GroupingInterval, gt GroupingType) *Filter

func (*Filter) Add

func (f *Filter) Add(r *Record) error

func (*Filter) Print

func (f *Filter) Print() error

type GroupingInterval

type GroupingInterval int

type GroupingType

type GroupingType int

type Merki

type Merki struct {
	// contains filtered or unexported fields
}

func New added in v0.0.9

func New(delimiter rune, o io.Writer) *Merki

func (*Merki) AddRecord

func (m *Merki) AddRecord(w io.Writer, record *Record) error

func (*Merki) DrawGraph added in v0.0.8

func (m *Merki) DrawGraph(r io.Reader, measure string) (string, error)

func (*Merki) DrawSparkLine added in v0.0.9

func (m *Merki) DrawSparkLine(r io.Reader, measure string) (string, error)

func (*Merki) Filter

func (m *Merki) Filter(r io.Reader, measure string, gi GroupingInterval, gt GroupingType) error

func (*Merki) Interval

func (m *Merki) Interval(r io.Reader, measure string, round RoundType) error

func (*Merki) Latest

func (m *Merki) Latest(r io.Reader) error

func (*Merki) Measurements

func (m *Merki) Measurements(r io.Reader) error

type Parser

type Parser struct {
	Record chan *Record
	Error  chan error
	Done   chan bool
	// contains filtered or unexported fields
}

func NewParser

func NewParser(delimiter string) *Parser

func (*Parser) ParseFile

func (p *Parser) ParseFile(fileName string)

func (*Parser) ParseStream

func (p *Parser) ParseStream(reader io.Reader)

type ParserCallback added in v0.0.9

type ParserCallback func(r *Record, err error) (bool, error)

type Record

type Record struct {
	Date        time.Time
	Measurement string
	Value       float64
	Name        string
	Description string
}

func NewRecord

func NewRecord(timestamp time.Time, measurement, value, name, description string) (*Record, error)

func NewRecordFromStrings

func NewRecordFromStrings(s []string) (*Record, error)

type RoundType added in v0.0.8

type RoundType int

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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