mod(taskwarrior): complete push implementation

Currently the merging process is not working entirely as I would
expect. There are no checks for actual changes between the local version
and the server version. WIP for #3. Configuration file created with
corresponding values like, user name and access code, which are - for
obvious reasons - not commited.
This commit is contained in:
2023-10-25 17:14:54 +02:00
parent 0cb4190540
commit 854dafde01
8 changed files with 160 additions and 47 deletions

View File

@@ -39,8 +39,8 @@ func (f *Filter) IncludeIds(ids ...uint) {
}
}
func (f *Filter) IncludeGitId(id uint) {
f.filter = append(f.filter, fmt.Sprintf("git_id=%d", id))
func (f *Filter) IncludeGitNumber(id uint) {
f.filter = append(f.filter, fmt.Sprintf("git_number=%d", id))
}
func (f *Filter) IncludeGitType(value Type) {

View File

@@ -15,12 +15,13 @@ import (
type Task struct {
Id uint `json:"id,omitempty"`
Git_id float32 `json:"git_id,omitempty"` // uda
Git_type string `json:"git_type,omitempty"` // uda
Git_number float32 `json:"git_number,omitempty"` // uda
Git_type string `json:"git_type,omitempty"` // uda
Project string `json:"project,omitempty"`
Tags []string `json:"tags,omitempty"`
Description string `json:"description,omitempty"`
Annotations []Annotation `json:"annotations,omitempty"`
Git_comment_ids string `json:"git_comment_ids,omitempty"` // uda
Status string `json:"status,omitempty"`
Depends []string `json:"depends,omitempty"`
Due string `json:"due,omitempty"`
@@ -33,25 +34,34 @@ type Task struct {
}
type Annotation struct {
Id int `json:"-"`
Description string `json:"description,omitempty"`
Entry string `json:"entry,omitempty"`
}
func (task *Task) AppendComment(description string, time time.Time) {
func (task *Task) AppendComment(comment_id int, description string, time time.Time) {
annotation := Annotation{
Id: comment_id,
Description: description,
Entry: GoTimeToTaskTime(time),
}
var comment_ids []string
comment_ids = nil
if len(task.Git_comment_ids) > 0 {
comment_ids = strings.Split(task.Git_comment_ids, ",")
}
comment_ids = append(comment_ids, fmt.Sprintf("%d", comment_id))
task.Git_comment_ids = strings.Join(comment_ids, ",")
task.Annotations = append(task.Annotations, annotation)
}
func NewTask(description string, project string, git_id uint, git_type Type, tags ...string) Task {
func NewTask(description string, project string, git_number uint, git_type Type, tags ...string) Task {
// TODO: update task struct to include the new user defined value, which shall
// also be provided as an argument
return Task{
Project: project,
Description: description,
Git_id: float32(git_id),
Git_number: float32(git_number),
Git_type: string(git_type),
Last_gitw_update: GoTimeToTaskTime(time.Now()),
Tags: tags,