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

@@ -1,16 +1,33 @@
package gitea
import (
"encoding/json"
"fmt"
"os"
)
var API_PATH = "/api/v1"
type Gitea struct {
base_url string
Base_url string `json:"base_url"`
User_name string `json:"user_name"`
Access_code string `json:"access_code"`
}
func NewGitea(base_url string) (gitea Gitea) {
gitea.base_url = base_url
func NewGitea() (gitea Gitea) {
configJson, err := os.ReadFile("./configs/gitw.json")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(-1)
}
err = json.Unmarshal(configJson, &gitea)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(-1)
}
return
}
func (gitea *Gitea) Url() string {
return gitea.base_url + API_PATH
return gitea.Base_url + API_PATH
}