This commit is contained in:
Omid The Great
2024-01-28 17:38:37 +03:30
parent b7e0bc0f4a
commit a5435e6101
20 changed files with 1145 additions and 0 deletions

10
cmd/cmd_service.go Normal file
View File

@@ -0,0 +1,10 @@
package main
import (
"github.com/spf13/cobra"
)
var commandService = &cobra.Command{
Use: "service",
Short: "Sign box service",
}

View File

@@ -0,0 +1,12 @@
package main
import (
"github.com/hiddify/libcore/service"
"github.com/spf13/cobra"
)
var commandServiceInstall = &cobra.Command{
Use: "install",
Short: "install the service",
Run: service.InstallService,
}

12
cmd/cmd_service_start.go Normal file
View File

@@ -0,0 +1,12 @@
package main
import (
"github.com/hiddify/libcore/service"
"github.com/spf13/cobra"
)
var commandServiceStart = &cobra.Command{
Use: "start",
Short: "Start a sign box instance",
Run: service.StartService,
}

12
cmd/cmd_service_stop.go Normal file
View File

@@ -0,0 +1,12 @@
package main
import (
"github.com/hiddify/libcore/service"
"github.com/spf13/cobra"
)
var commandServiceStop = &cobra.Command{
Use: "stop",
Short: "stop sign box",
Run: service.StopService,
}

View File

@@ -22,8 +22,17 @@ var mainCommand = &cobra.Command{
}
func init() {
mainCommand.AddCommand(commandService)
commandService.AddCommand(commandServiceStart)
commandService.AddCommand(commandServiceStop)
commandService.AddCommand(commandServiceInstall)
commandServiceStart.Flags().Int("port", 8080, "Webserver port number")
mainCommand.PersistentFlags().StringVarP(&workingDir, "directory", "D", "", "set working directory")
mainCommand.PersistentFlags().BoolVarP(&disableColor, "disable-color", "", false, "disable color output")
}
func main() {