revamp: start simple
This commit is contained in:
34
cmd/cmd.go
34
cmd/cmd.go
@@ -1,34 +0,0 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
initpkg "gitea.suyono.dev/suyono/wingmate/cmd/init"
|
||||
"gitea.suyono.dev/suyono/wingmate/config"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
rootCmd = &cobra.Command{
|
||||
Use: "wingmate",
|
||||
Short: "your service companion",
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
config.BindFlags(rootCmd)
|
||||
|
||||
rootCmd.AddCommand(
|
||||
initpkg.Command(),
|
||||
)
|
||||
}
|
||||
|
||||
func Execute() error {
|
||||
if os.Args[0] != rootCmd.Use {
|
||||
rootCmd.SetArgs(os.Args)
|
||||
} else {
|
||||
rootCmd.SetArgs(os.Args[1:])
|
||||
}
|
||||
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package init
|
||||
|
||||
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() *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
|
||||
}
|
||||
5
cmd/wingmate/wingmate.go
Normal file
5
cmd/wingmate/wingmate.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user