This implementation adds the necessary fields for the tasks of taskwarrior to be synchronized with git. It provides the necessary conversion of the taskwarrior times and the standard time.Time go format. WIP for #3.
52 lines
1.6 KiB
Go
52 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"gitea.yves-biener.de/yves-biener/gitwarrior/internal/gitea"
|
|
"gitea.yves-biener.de/yves-biener/gitwarrior/internal/gitw"
|
|
)
|
|
|
|
func main() {
|
|
// TODO: server url may be also be derived from the git configuration?
|
|
server := gitea.NewGitea("https://gitea.yves-biener.de")
|
|
repository, err := gitw.Discover()
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(-1)
|
|
}
|
|
repository, err = server.VerifyRepository(repository)
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(-1)
|
|
}
|
|
project := gitw.NewProject(server, repository)
|
|
|
|
if err = project.Fetch(); err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(-1)
|
|
}
|
|
fmt.Printf("%#v\n", project)
|
|
|
|
// NOTE: this can be used to add / modify tasks
|
|
// var update_tasks []taskwarrior.Task
|
|
// task := taskwarrior.NewTask(
|
|
// "This is a test task from gitwarrior",
|
|
// "gitwarrior",
|
|
// "issue",
|
|
// )
|
|
// update_tasks = append(update_tasks, task)
|
|
// taskwarrior.UpdateTasks(update_tasks)
|
|
|
|
// necessary configurations (see config file gitw.json)
|
|
// - access code for gitea
|
|
// - configuration for taskwarrior settings?
|
|
|
|
// cli actions and parameters
|
|
// - action: diff (i.e. what has changed between the current state of the taskwarrior tasks and the git issues / milestones)
|
|
// - action: status (are there changes between the taskwarrior tasks and the gitea issues / milestones, that would require a sync)
|
|
// - action: sync (synch diffs between taskwarrior tasks and gitea issues / milestones)
|
|
// - parameter: --dry-run (do only show changes that would be applied but do not apply them)
|
|
}
|