tm

package module
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 5 Imported by: 0

README

tm

CI

Time Calculator.

Usage

Usage: tm [<expr>]

Arguments:
  [<expr>]    Expression to evaluate.

Flags:
  -h, --help       Show help.
      --version

Installation

brew install winebarrel/tm/tm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dur

type Dur time.Duration

func (*Dur) Capture

func (v *Dur) Capture(values []string) error

type Expr

type Expr struct {
	Mul    Mul     `@@`
	OpMuls []OpMul `( SP* @@ )*`
}

func (*Expr) Eval

func (expr *Expr) Eval() time.Duration

type Mul added in v1.2.0

type Mul struct {
	Primary Primary `@@`
	OpNums  []OpNum `( SP* @@ )*`
}

func (*Mul) Eval added in v1.2.0

func (v *Mul) Eval() time.Duration

type OpMul added in v1.2.0

type OpMul struct {
	Op  string `( @"+" | @"-" )`
	Mul Mul    `SP* @@`
}

type OpNum added in v1.2.0

type OpNum struct {
	Op  string `( @"*" | @"/" )`
	Num int    `SP* @Num`
}

type Primary added in v1.2.0

type Primary struct {
	Value *Value `@@`
	Expr  *Expr  `| "(" SP* @@ SP* ")"`
}

func (*Primary) Eval added in v1.2.0

func (v *Primary) Eval() time.Duration

type Result

type Result time.Duration

func Eval

func Eval(str string) (Result, error)

func (Result) String

func (r Result) String() string

type Tm

type Tm time.Duration

func (*Tm) Capture

func (v *Tm) Capture(values []string) error

type Value

type Value struct {
	Tm  *Tm  `@Tm`
	Dur *Dur `| ( @Dur | @Num )`
}

func (*Value) Eval added in v1.2.0

func (v *Value) Eval() time.Duration

Directories

Path Synopsis
cmd
tm
internal

Jump to

Keyboard shortcuts

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