run

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstallBaseDirectory string      = "spikes/"
	TasksPath            string      = "tasks.json"
	FolderPermission     fs.FileMode = 00775
	FilePermission       fs.FileMode = 00644
	OpenStatus           string      = "O"
	ClosedStatus         string      = "C"
	ColorCyan            string      = "\033[0;36m"
	ColorStop            string      = "\033[0m"
)

Variables

View Source
var (
	OutputBaseDirectory = getUserHome()
	OutputDirectory     = path.Join(OutputBaseDirectory, InstallBaseDirectory)
	OutputPath          = path.Join(OutputDirectory, TasksPath)
)

Functions

func Add

func Add(files []string) int

Git command wrapper for `git add`

func Commit added in v0.0.16

func Commit(message string) int

Git command wrapper for `git commit`

func Create

func Create(name string, description string) int

Create a new task based on the data input via the CLI

func Init

func Init() int

Git command wrapper for `git init`

func List

func List(status string) int

List tasks

func NewTaskID

func NewTaskID(taskList *TaskList) int

Find the highest ID in the tasks list then increment by 1

func Pull

func Pull() int

Git command wrapper for `git pull`

func Push

func Push() int

Git command wrapper for `git push`

func SaveTaskList

func SaveTaskList(tasks *TaskList) error

Save the task list back to JSON

func Update

func Update(id int, key string, value string, status string) int

Update a task's name, description, or status

Types

type Task

type Task struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Created     string `json:"created"`
	Updated     string `json:"updated"`
	ID          int    `json:"id"`
}

Nullable values should be pointers

type TaskList

type TaskList struct {
	Open   []Task `json:"O"`
	Closed []Task `json:"C"`
}

func NewTaskList

func NewTaskList() *TaskList

Read tasks.json file and return representation of data in sorted form. Each "O" and "C" slice is sorted in descending order.

func (*TaskList) AddTask

func (tl *TaskList) AddTask(t Task, status string) error

Add a task to the task list

func (*TaskList) UpdateTaskDescription

func (tl *TaskList) UpdateTaskDescription(id int, desc string) error

func (*TaskList) UpdateTaskName

func (tl *TaskList) UpdateTaskName(id int, name string) error

func (*TaskList) UpdateTaskStatus

func (tl *TaskList) UpdateTaskStatus(id int, status string) error

Swap a task status between closed an open

Jump to

Keyboard shortcuts

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