Taskwarrior v0.4.0 Taskwarrior.Task View Source
A representation of a Taskwarrior task
The struct field names are, to the degree that it's possible, following the
names of the fields that are found in JSON exports from Taskwarrior's task export
.
Notes about the structs:
- Some fields are not always set. Examples would be a task having no project,
or
end
not being set due to the task not having thestatus
ofcompleted
. In these cases, the value will be set tonil
. - The
Taskwarrior.Task
structs do not have all of the fields that Taskwarrior tasks can possibly have. This is primarily due to functionality not being implemented yet.
Link to this section Summary
Functions
Builds a struct from a JSON-decoded Taskwarrior task
Link to this section Functions
Builds a struct from a JSON-decoded Taskwarrior task
The struct created by this function mostly consist of unmodified data from the exported Taskwarrior task.
Note: The dates are parsed as DateTime
structs with the timezone being
set to UTC, which is how Taskwarrior stores its time values. Currently there
is no way to have the values be converted to an alternative timezone.
User Defined Attributes (UDA)
The opts[:udas]
key needs to be populated with an "UDA list". These are the
types of elements allowed in the list:
:uda_name
- UDAs of the typesnumeric
,duration
, andstring
. Needs to match the UDA name in the JSON data.{:uda_name, :date}
- UDAs of thedate
type need to be parsed, therefore they need to be indicated with this shape.
Examples
iex> Taskwarrior.Task.build(json_task)
%Taskwarrior.Task{...}
iex> Taskwarrior.Task.build(json_task, udas: [:foobar, :baz])
%Taskwarrior.Task{...}
iex> Taskwarrior.Task.build(json_task, udas: [:foobar, :baz, quux: :date])
%Taskwarrior.Task{...}