format

package
v0.0.0-...-6568698 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDeletedJSON

func FormatDeletedJSON(displayID uint) (string, error)

FormatDeletedJSON returns a JSON response for a deleted task.

func FormatRemovedPretty

func FormatRemovedPretty(displayID uint) string

FormatRemovedPretty formats the removal message.

func FormatTaskJSON

func FormatTaskJSON(task todo.Task) (string, error)

FormatTaskJSON converts a single task to JSON string.

func FormatTaskPretty

func FormatTaskPretty(task todo.Task, action string) (string, error)

FormatTaskPretty formats a single task as a one-liner for add/complete operations. Format: "Task {displayID} added." or "Task {displayID} completed." Note: displayID should be passed as a parameter since the task's DisplayID may be nil after completion.

func FormatTaskPrettyWithID

func FormatTaskPrettyWithID(displayID uint, action string) string

FormatTaskPrettyWithID formats a single task as a one-liner using an explicit displayID. This is useful when the task's DisplayID may be nil (e.g., after completion).

func FormatTasksJSON

func FormatTasksJSON(tasks []todo.Task) (string, error)

FormatTasksJSON converts a slice of tasks to JSON string.

func FormatTasksPretty

func FormatTasksPretty(tasks []todo.Task, reference time.Time) (string, error)

FormatTasksPretty formats multiple tasks grouped by due date for reports.

Types

type TaskOutput

type TaskOutput struct {
	ULID        string `json:"ulid"`         // Unique identifier
	ID          *uint  `json:"id,omitempty"` // DisplayID
	Description string `json:"description"`
	Priority    bool   `json:"priority"`
	Due         string `json:"due,omitempty"` // YYYY-MM-DD format
	Status      string `json:"status"`
	CompletedAt string `json:"completed_at,omitempty"` // YYYY-MM-DD format
	CreatedAt   string `json:"created_at"`
}

TaskOutput represents a task in JSON output format.

Jump to

Keyboard shortcuts

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