mirror of
https://github.com/acepanel/helper.git
synced 2026-02-04 13:47:17 +08:00
feat: init
This commit is contained in:
16
cmd/helper/main.go
Normal file
16
cmd/helper/main.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "time/tzdata"
|
||||
)
|
||||
|
||||
func main() {
|
||||
helper, err := initHelper()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err = helper.Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
19
cmd/helper/wire.go
Normal file
19
cmd/helper/wire.go
Normal file
@@ -0,0 +1,19 @@
|
||||
//go:build wireinject
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/google/wire"
|
||||
|
||||
"github.com/acepanel/helper/internal/app"
|
||||
"github.com/acepanel/helper/internal/service"
|
||||
"github.com/acepanel/helper/internal/system"
|
||||
)
|
||||
|
||||
func initHelper() (*app.Helper, error) {
|
||||
panic(wire.Build(
|
||||
system.ProviderSet,
|
||||
service.ProviderSet,
|
||||
app.ProviderSet,
|
||||
))
|
||||
}
|
||||
32
cmd/helper/wire_gen.go
Normal file
32
cmd/helper/wire_gen.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Code generated by Wire. DO NOT EDIT.
|
||||
|
||||
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
|
||||
//go:build !wireinject
|
||||
// +build !wireinject
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/acepanel/helper/internal/app"
|
||||
"github.com/acepanel/helper/internal/service"
|
||||
"github.com/acepanel/helper/internal/system"
|
||||
)
|
||||
|
||||
import (
|
||||
_ "time/tzdata"
|
||||
)
|
||||
|
||||
// Injectors from wire.go:
|
||||
|
||||
func initHelper() (*app.Helper, error) {
|
||||
executor := system.NewExecutor()
|
||||
detector := system.NewDetector(executor)
|
||||
firewall := system.NewFirewall(executor, detector)
|
||||
systemd := system.NewSystemd(executor)
|
||||
userManager := system.NewUserManager(executor)
|
||||
installer := service.NewInstaller(detector, executor, firewall, systemd, userManager)
|
||||
uninstaller := service.NewUninstaller(detector, executor, systemd)
|
||||
mounter := service.NewMounter(detector, executor)
|
||||
helper := app.NewHelper(installer, uninstaller, mounter)
|
||||
return helper, nil
|
||||
}
|
||||
Reference in New Issue
Block a user