Files
mstore/cmd/mstorectl/main.go
T
2026-01-23 19:26:56 +02:00

56 lines
809 B
Go

package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
func main() {
var err error
util := NewUtil()
err = util.Build()
if err != nil {
os.Exit(1)
}
err = util.Exec(os.Args[1:])
if err != nil {
os.Exit(1)
}
}
type Util struct {
FileUtil
rootCmd cobra.Command
}
func NewUtil() *Util {
return &Util{}
}
func (util *Util) Build() error {
var err error
rootCmd := cobra.Command{
Use: "cmd",
Short: "A brief description the command",
}
rootCmd.CompletionOptions.DisableDefaultCmd = true
util.rootCmd = rootCmd
util.AddFileCmds()
return err
}
func (util *Util) Exec(args []string) error {
var err error
util.rootCmd.SetArgs(args)
err = util.rootCmd.Execute()
return err
}
func (util *Util) Hello(cmd *cobra.Command, args []string) {
fmt.Println("hello, world!")
}