wip: process management
This commit is contained in:
14
cmd/cmd.go
14
cmd/cmd.go
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"gitea.suyono.dev/suyono/wingmate/cmd/init"
|
||||
"gitea.suyono.dev/suyono/wingmate/config"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
)
|
||||
@@ -11,17 +12,14 @@ var (
|
||||
Use: "wingmate",
|
||||
Short: "your service companion",
|
||||
}
|
||||
|
||||
initCmd = &cobra.Command{
|
||||
Use: "init",
|
||||
Short: "dummy init",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: init.Command,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(initCmd)
|
||||
config.BindFlags(rootCmd)
|
||||
|
||||
rootCmd.AddCommand(
|
||||
init.Command(),
|
||||
)
|
||||
}
|
||||
|
||||
func Execute() error {
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
package init
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
import (
|
||||
"gitea.suyono.dev/suyono/wingmate/config"
|
||||
"gitea.suyono.dev/suyono/wingmate/daemon"
|
||||
"gitea.suyono.dev/suyono/wingmate/middleware"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func Command(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
func Command() *cobra.Command {
|
||||
init := &cobra.Command{
|
||||
Use: "init",
|
||||
Short: "dummy init",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return middleware.CallChain(cmd, args, config.Read, daemon.Start)
|
||||
},
|
||||
}
|
||||
|
||||
return init
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user