commands

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ChronoAppConf = "chrono"

ChronoAppConf is the name of the app's data directory

View Source
const ChronoConfDirEnvName = "CHRONO_CONFIG_DIR"

ChronoConfDirEnvName is name of the environment variable used to manually set the config directory

Variables

This section is empty.

Functions

func ConfirmDelete

func ConfirmDelete(frame chronolib.Frame) bool

ConfirmDelete asks user if they are sure they want to delete the frame

func Execute

func Execute()

Execute creates the root command with all sub-commands installed

func GetAdjustedTime

func GetAdjustedTime(t time.Time) time.Time

GetAdjustedTime rounds a time to a given interval. E.g if the time is 15:02:13 and the interval is 5 minutes it would be rounded to 15:00:00

func GetFrame

func GetFrame(frames chronolib.Frames, target string) (chronolib.Frame, bool)

GetFrame is a helper method for getting a frame by either index or UUID

func GetToFromTimespan

func GetToFromTimespan(from string, to string) (chronolib.TimespanFilterOptions, error)

GetToFromTimespan is a helper function that takes in two time formats and attempts to parse them

func ParseStartArgs

func ParseStartArgs(args []string, startAt string, startEnded string, startNote string) (chronolib.CurrentFrame, time.Time, error)

ParseStartArgs properly handles user arguments for the start command

func ParseStartArguments

func ParseStartArguments(args []string) (string, []string, error)

ParseStartArguments splits the argument string list and validates tags

func ParseTime

func ParseTime(t string) (time.Time, error)

ParseTime converts a properly formated time string into a time.Time struct

func ParseTimespanFlags

func ParseTimespanFlags(timespanFlags TimespanFlags) chronolib.TimespanFilterOptions

ParseTimespanFlags gets the correct start and end time for filtering frames based on the flags given

func PrintErrorAndExit

func PrintErrorAndExit(e error)

PrintErrorAndExit prints an appropriate message depending on the error type. If the error type is unknown, panics

Types

type ErrTagNotValid added in v1.1.0

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

ErrTagNotValid represents when a file doesn't exist on the file system

func NewErrTagNotValid added in v1.1.0

func NewErrTagNotValid(message string) *ErrTagNotValid

NewErrTagNotValid return a ErrTimeStringNotValid

func (*ErrTagNotValid) Error added in v1.1.0

func (e *ErrTagNotValid) Error() string

Error returns the error message

type ErrTimeStringNotValid

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

ErrTimeStringNotValid represents when a file doesn't exist on the file system

func NewErrTimeStringNotValid

func NewErrTimeStringNotValid(message string) *ErrTimeStringNotValid

NewErrTimeStringNotValid return a ErrTimeStringNotValid

func (*ErrTimeStringNotValid) Error

func (e *ErrTimeStringNotValid) Error() string

Error returns the error message

type TimespanFlags

type TimespanFlags struct {
	AllTime      bool
	CurrentWeek  bool
	CurrentMonth bool
	CurrentYear  bool
	Yesterday    bool
}

TimespanFlags is a struct containing the four different options for timespans

Jump to

Keyboard shortcuts

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