lib

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ON  = "on"
	OFF = "off"
)

Constants to represent a status of the pomo.

View Source
const NOTIFICATION_MESSAGE = "🍅 Time to take a break!"

Variables

View Source
var DEFAULT_DURATION, _ = time.ParseDuration("25m")

Functions

This section is empty.

Types

type Pomo

type Pomo struct {
	Status   string // status running or not could be ON or OFF
	Time     time.Duration
	Notified bool
	Emoji    string    // default tomato emoji
	Blink    [2]string // array of 2 emoji to create an animation
	Cancel   chan bool // channel for cancelation a running timer goroutine
}

Pomo struct represents a pomodoro.

func (*Pomo) GetDuration

func (pomo *Pomo) GetDuration() string

GetDuration returns the current duration.

func (*Pomo) Restart

func (pomo *Pomo) Restart()

Restart restarts the pomo timer to default value.

func (*Pomo) SetDuration

func (pomo *Pomo) SetDuration(d time.Duration)

SetDuration sets the duration of pomo timer it accepts time.Duration parsable format.

func (*Pomo) Start

func (pomo *Pomo) Start()

Start starts the pomodoto timer by running a goroutine.

func (*Pomo) Stop

func (pomo *Pomo) Stop()

Stop stops the running timer goroutine.

type PomoAPI

type PomoAPI struct {
	Pomo *Pomo
}

PomoAPI type for interaction with pomo. This type exposed and registered as specified in RPC.

func (*PomoAPI) GetDuration

func (api *PomoAPI) GetDuration(_ bool, r *Reply) error

GetDuration API call. The first argument provided by caller is always nil.

func (*PomoAPI) Restart

func (api *PomoAPI) Restart(_ bool, r *Reply) error

Restart API call.

func (*PomoAPI) SetDuration

func (api *PomoAPI) SetDuration(d time.Duration, r *Reply) error

SetDuration API call. Takes a duration time format and calls SetDuration pomo's method.

func (*PomoAPI) Start

func (api *PomoAPI) Start(_ bool, r *Reply) error

Start API call. The first argument provided by caller is always nil.

func (*PomoAPI) Stop

func (api *PomoAPI) Stop(_ bool, r *Reply) error

Stop API call. The first argument provided by caller is always nil.

type Reply

type Reply string

Reply type is just an alisas to a string and defined just for semantical reason.

Jump to

Keyboard shortcuts

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