gurnel

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(r io.Reader, w io.Writer, conf *Config) error

func IsEntry

func IsEntry(path string) bool

IsEntry returns true if path refers to a file with an Entry-like name, false otherwise.

Types

type Config added in v1.2.0

type Config struct {
	BeeminderEnabled   bool
	BeeminderUser      string
	BeeminderTokenFile string
	BeeminderGoal      string
	MinimumWordCount   int
	Editor             string
	// contains filtered or unexported fields
}

func (*Config) Load added in v1.2.0

func (c *Config) Load(path ...string) error

type Entry

type Entry struct {
	Seconds     uint16
	LowMood     uint8
	HighMood    uint8
	AverageMood uint8
	Body        []byte    `yaml:"-"`
	Path        string    `yaml:"-"`
	ModTime     time.Time `yaml:"-"`
}

Entry represents a single journal entry.

func NewEntry

func NewEntry(dir string, t time.Time) (*Entry, error)

NewEntry reads the directory named by dir and either returns an existing Entry in that directory, or creates a new one if none exist.

func (*Entry) Date

func (p *Entry) Date() (time.Time, error)

Date returns the date of the entry

func (*Entry) Load

func (p *Entry) Load() (modified bool, err error)

Load reads the file named by p.Path and populates the Entry

func (*Entry) PromptForMetadata

func (p *Entry) PromptForMetadata(reader io.Reader, w io.Writer) error

PromptForMetadata prints questions to w and sets the values of p based on values read from reader.

func (*Entry) Save

func (p *Entry) Save() (err error)

Save writes the Entry to the file named by p.Path

func (*Entry) Words

func (p *Entry) Words() [][]byte

Words returns the number of words in p.body

Jump to

Keyboard shortcuts

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