// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. package main import ( "fmt" "github.com/TeaOSLab/EdgeReporter/internal/apps" teaconst "github.com/TeaOSLab/EdgeReporter/internal/const" "github.com/TeaOSLab/EdgeReporter/internal/nodes" ) func main() { app := apps.NewAppCmd(). Version(teaconst.Version). Product(teaconst.ProductName). Usage(teaconst.ProcessName + " [-v|start|stop|restart|service|daemon]") app.On("daemon", func() { nodes.NewReportNode().Daemon() }) app.On("service", func() { err := nodes.NewReportNode().InstallSystemService() if err != nil { fmt.Println("[ERROR]install failed: " + err.Error()) return } fmt.Println("done") }) app.On("run", func() { reporterNode := nodes.NewReportNode() reporterNode.Run() }) app.Run(func() { reporterNode := nodes.NewReportNode() reporterNode.Run() }) }