cmd

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var (
	Title string
	Knock string
)

Functions

func Check

func Check(d Date)

Runs a check of the events from the vantage of the given date

func DateMatches

func DateMatches(candidate Date, reference Date) bool

Preconditions: reference date has no wildcard in year, month or day position

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func HasRunTodaysUpdates

func HasRunTodaysUpdates() bool

Function that checks whether today's update checking has been completed.

func MarkTodaysUpdatesAsRead

func MarkTodaysUpdatesAsRead()

func PrintEvents

func PrintEvents(events []Event)

func PrintKnockEvents

func PrintKnockEvents(events []KnockEvent)

Types

type Calendar

type Calendar string
const (
	BS Calendar = "BS"
)

type Date

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

func DateAfterAddition

func DateAfterAddition(date Date, noOfDays int) Date

Add the given number of days and return the Date

Preconditions: date contains no wildcard in year, month, or day positions

func (Date) String

func (d Date) String() string

type Event

type Event struct {
	Id    string // Usually, time.UnixNano is used for Id
	Date  string
	Title string
	Knock []int
}

func (Event) String

func (e Event) String() string

type EventsFileModel added in v1.2.0

type EventsFileModel struct {
	Events []Event
}

type KnockEvent

type KnockEvent struct {
	Event
	ComingUpIn int
}

type KnockEvents

type KnockEvents []KnockEvent

This struct is made for to implement sort on slice of knock events

func (KnockEvents) Len

func (k KnockEvents) Len() int

func (KnockEvents) Less

func (k KnockEvents) Less(i, j int) bool

func (KnockEvents) Swap

func (k KnockEvents) Swap(i, j int)

type MatchingEvents

type MatchingEvents struct {
	Today []Event
	Knock []KnockEvent
}

A collection of matching events

func CheckEventsOnDate

func CheckEventsOnDate(date Date, events []Event) MatchingEvents

Returns matching events for the given date Note that it only matches events on the same calendar This means that if you would like to get matching events from all calendars, you'll have to run this dates with different calendars

Jump to

Keyboard shortcuts

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