command

package
v0.0.0-...-1b63e00 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddEntryCommand

type AddEntryCommand struct {
	DataSource datasource.DataSource
	Renderer   renderer.Renderer
	Date       string
	Food       string
	Calories   string
	Mode       int
}

AddEntryCommand is the command to add an entry for a day

func (*AddEntryCommand) Execute

func (c *AddEntryCommand) Execute() (string, error)

Execute shows, if there is no date parameter given, the given calories and food are added to the current day, otherwise to the given date

type ClearEntriesCommand

type ClearEntriesCommand struct {
	DataSource datasource.DataSource
	Renderer   renderer.Renderer
	Date       string
	Position   int
	YesMode    bool
}

ClearEntriesCommand is the command to clear entries for a given day

func (*ClearEntriesCommand) Execute

func (c *ClearEntriesCommand) Execute() (string, error)

Execute removes all entries of the current day, if no parameters are given otherwise it removes the entries of the given date. Asks the user for confirmation

type Command

type Command interface {
	Execute() (string, error)
}

Command is the interface for the commands

type ConfigCommand

type ConfigCommand struct {
	DataSource datasource.DataSource
	Renderer   renderer.Renderer
	Weight     float64
	Height     float64
	Activity   float64
	Birthday   string
	Gender     string
	UnitSystem string
	YesMode    bool
	Mode       int
}

ConfigCommand is the command to save and show the configuration

func (*ConfigCommand) Execute

func (c *ConfigCommand) Execute() (string, error)

Execute shows the current config, if no parameters are given, otherwise it parses the given configuration and saves it to the database, asking for confirmation first The weight from the given config is added to the weight table

type DayCommand

type DayCommand struct {
	DataSource  datasource.DataSource
	Renderer    renderer.Renderer
	Week        bool
	Month       bool
	History     int
	DefaultDate string
}

DayCommand is the command to show a range of days

func (*DayCommand) Execute

func (c *DayCommand) Execute() (string, error)

Execute shows the current day, if no parameters are used, otherwise shows the days for the given time span (day, week, month, history of days)

type ExportCommand

type ExportCommand struct {
	DataSource datasource.DataSource
}

ExportCommand is the command to export the database

func (*ExportCommand) Execute

func (c *ExportCommand) Execute() (string, error)

Execute fetches the export data and writes it to the given file as JSON

type ImportCommand

type ImportCommand struct {
	DataSource datasource.DataSource
	Renderer   renderer.Renderer
	File       string
}

ImportCommand is the command to export the database

func (*ImportCommand) Execute

func (c *ImportCommand) Execute() (string, error)

Execute parses and imports the data from the given file

type WeightCommand

type WeightCommand struct {
	DataSource datasource.DataSource
	Renderer   renderer.Renderer
	Weight     string
	Mode       int
}

WeightCommand is the command to save and show the configuration

func (*WeightCommand) Execute

func (c *WeightCommand) Execute() (string, error)

Execute shows the weight timeline, if no parameters are given, otherwise it sets the given weight

Jump to

Keyboard shortcuts

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