-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
46 lines (41 loc) · 938 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"flag"
"log"
"github.com/lufia/taskfs/backlog"
"github.com/lufia/taskfs/fs"
"github.com/lufia/taskfs/github"
"github.com/lufia/taskfs/gitlab"
)
var (
debug = flag.Bool("d", false, "turn on debug print")
mtpt = "/mnt/taskfs"
)
func main() {
flag.Parse()
root := fs.NewRoot()
root.RegisterService("github", func(token, url string) (fs.Service, error) {
return github.NewService(&github.Config{
BaseURL: url,
Token: token,
})
})
root.RegisterService("gitlab", func(token, url string) (fs.Service, error) {
return gitlab.NewService(&gitlab.Config{
BaseURL: url,
Token: token,
})
})
root.RegisterService("backlog", func(token, url string) (fs.Service, error) {
return backlog.NewService(&backlog.Config{
BaseURL: url,
APIKey: token,
})
})
if flag.NArg() > 0 {
mtpt = flag.Arg(0)
}
if err := root.MountAndServe(mtpt, *debug); err != nil {
log.Fatal(err)
}
}