mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
36 lines
612 B
Go
36 lines
612 B
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"n.eko.moe/neko"
|
||
|
"n.eko.moe/neko/internal/preflight"
|
||
|
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
func Execute() error {
|
||
|
return root.Execute()
|
||
|
}
|
||
|
|
||
|
var root = &cobra.Command{
|
||
|
Use: "neko",
|
||
|
Short: "",
|
||
|
Long: ``,
|
||
|
Version: neko.Service.Version.String(),
|
||
|
}
|
||
|
|
||
|
func init() {
|
||
|
cobra.OnInitialize(func() {
|
||
|
preflight.Logs("neko")
|
||
|
preflight.Config("neko")
|
||
|
neko.Service.Root.Set()
|
||
|
})
|
||
|
|
||
|
if err := neko.Service.Root.Init(root); err != nil {
|
||
|
neko.Service.Logger.Panic().Err(err).Msg("Unable to run command")
|
||
|
}
|
||
|
|
||
|
root.SetVersionTemplate(fmt.Sprintf("Version: %s\n", neko.Service.Version))
|
||
|
}
|