.
This commit is contained in:
10
cmd/cmd_service.go
Normal file
10
cmd/cmd_service.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var commandService = &cobra.Command{
|
||||
Use: "service",
|
||||
Short: "Sign box service",
|
||||
}
|
||||
12
cmd/cmd_service_install.go
Normal file
12
cmd/cmd_service_install.go
Normal 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
12
cmd/cmd_service_start.go
Normal 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
12
cmd/cmd_service_stop.go
Normal 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,
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user