/
service.go
93 lines (75 loc) · 1.62 KB
/
service.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package app
import (
"github.com/gookit/config/v2"
"github.com/gookit/gcli/v3"
"github.com/gookit/goutil/maputil"
"github.com/gookit/rux"
"github.com/gookit/slog"
"github.com/inhere/kite-go/pkg/gitx"
"github.com/inhere/kite-go/pkg/gitx/github"
"github.com/inhere/kite-go/pkg/gitx/gitlab"
"github.com/inhere/kite-go/pkg/httptpl"
"github.com/inhere/kite-go/pkg/kiteext"
"github.com/inhere/kite-go/pkg/kscript"
"github.com/inhere/kite-go/pkg/lcproxy"
"github.com/inhere/kite-go/pkg/quickjump"
)
const (
ObjCli = "cli"
ObjRux = "rux"
ObjConf = "config"
ObjLog = "logger"
ObjPlugin = "plugin"
ObjScript = "script"
ObjGit = "git"
ObjGlab = "gitlab"
ObjGhub = "github"
)
var (
// L kite logger
L *slog.Logger
// CL kite console logger
CL *slog.Logger
// SL server logger
SL *slog.Logger
)
var (
Lcp *lcproxy.LocalProxy
// AlsRun *kiteext.KiteAliasRun
Scripts *kscript.Runner
Plugins *kiteext.PluginRunner
QJump *quickjump.QuickJump
// PathMap data
PathMap *kiteext.PathMap
OpenMap maputil.Aliases
Vars *kiteext.VarMap
HTpl *httptpl.Manager
)
// Cfg get the config object
func Cfg() *config.Config {
return Get[*config.Config](ObjConf)
}
// Rux get the web app
func Rux() *rux.Router {
return Get[*rux.Router](ObjRux)
}
// Cli get the cli app
func Cli() *gcli.App {
return Get[*gcli.App](ObjCli)
}
// Log get
func Log() *slog.Logger {
return Get[*slog.Logger](ObjLog)
}
// Glab get
func Glab() *gitlab.GitLab {
return Get[*gitlab.GitLab](ObjGlab)
}
// Ghub get
func Ghub() *github.GitHub {
return Get[*github.GitHub](ObjGhub)
}
// Gitx get
func Gitx() *gitx.Config {
return Get[*gitx.Config](ObjGit)
}