Documentation ¶
Index ¶
- Variables
- func Add(out io.Writer, server AddTaskServer, args []string, filePath string) error
- func Complete(out io.Writer, ts TasksServer, args []string) error
- func FilterTask(id string, tasks []api.Task) []api.Task
- func GetTaskAtPosition(ts TasksServer, p int) (api.Task, error)
- func List(out io.Writer, server ListServer, args []string) error
- func Login(in io.Reader, out io.Writer, as Authenticator, args []string)
- func ParseTaskFromArguments(args []string) api.Task
- func ParseTasksFromFile(filePath string) ([]api.Task, error)
- func Remove(in io.Reader, out io.Writer, args []string, server DeleteServer) error
- func RemoveForced(in io.Reader, out io.Writer, args []string, server DeleteServer) error
- func Status(out io.Writer, server StatusServer) error
- func StatusMessage(resp api.Status) string
- type AddTaskServer
- type Authenticator
- type DeleteServer
- type ListServer
- type StatusServer
- type TasksServer
Constants ¶
This section is empty.
Variables ¶
var TaskLine = regexp.MustCompile("(?m)^\\[ \\] (.*)$")
TaskLine is the Perl regular expression `(?m)^\\[ \\] (.*)$` `(?m)` sets flags so that `^` `$` match line beginning endings.
Functions ¶
func Add ¶
Add or `go-habits add` command allows habiters to add new tasks to their list of todos. When running this command the format expected is like follows: go-habits a {{ TaskTitle }} TODO allow `due:DATE` to be parse and set via api.SetDueDate(t)
func Complete ¶
func Complete(out io.Writer, ts TasksServer, args []string) error
Complete or `go-habits complete` allows habiters to complete todos on their existing list. `complete` task in a interger number representing the position of the todo they would like to complete.
func FilterTask ¶
FilterTask will filter a array of tasks by id.
func GetTaskAtPosition ¶
func GetTaskAtPosition(ts TasksServer, p int) (api.Task, error)
GetTaskAtPosition returns todo from task server at a given position or index
func List ¶
func List(out io.Writer, server ListServer, args []string) error
List or `go-habits list` command allows habiters to see their list of todos currently needing to be completed.
func Login ¶
Login or `go-habits login` allows habiters to logon to a habitica server and save their api id and token to a config file. The file must be previously created.
func ParseTaskFromArguments ¶
ParseTaskFromArguments parses an api.Task from []string
func ParseTasksFromFile ¶
ParseTasksFromFile will return an array of tasks that matches `TaskLine` in the file given, line by line.
func RemoveForced ¶
RemoveForced will remove tasks without asking by order as given in arguments from a `DeleteServer`
func Status ¶
func Status(out io.Writer, server StatusServer) error
Status or `go-habits status` allows habiters to check if the habitica server api is up and running.
func StatusMessage ¶
StatusMessage returns text based on Status message
Types ¶
type AddTaskServer ¶
type AddTaskServer interface { AddTask(api.Task) (api.Task, error) GetTasks(api.TaskType) []api.Task }
AddTaskServer interface handles adding and getting tasks from a habits server
type Authenticator ¶
Authenticator small interface for Authenticating users by password and username to return a Token
type DeleteServer ¶
type DeleteServer interface { TasksServer DeleteTask(api.Task) error }
DeleteServer interface does everything a `TaskServer` does and Deletes tasks.
type ListServer ¶
ListServer interface GetTasks will return []Task
type StatusServer ¶
StatusServer is an interface for habitica server that has an Server status