util

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package util provides general utility functions used throughout the TidyTask application .

These functions support the core functionality by handling shared concerns.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNoTasks is a custom error for when the input task list is empty
	ErrNoTasks = errors.New("no tasks")
)

Functions

func ConfirmAction

func ConfirmAction(prompt string) bool

ConfirmAction prompts the user for a message and waits for yes/no confirmation it reads user input to stdin and returns true if the user responds with "y" or "yes" any other input is treated as a negative response

func FilterTasks

func FilterTasks(tasks []task.Task,
	filterComplete bool, filterPriority bool, filterNotComplete bool, filterNotPriority bool) []task.Task

FilterTasks takes a slice of Task structs and returns a new slice only tasks that satisfy all enabled filters are added to the new slice

func PrintTasks

func PrintTasks(tasks []task.Task) error

PrintTasks takes a slice of Task structs and displays them as a colour coded table in the terminal

func VerifyDate

func VerifyDate(date string) error

VerifyDate checks if the input string is a valid date in DD-MM-YYYY format. returns an error if the format is invalid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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