package main

import (
	"fmt"
	"os"
	"time"

	"github.com/spf13/cobra/doc"

	"mstore/cmd/mstored/starter"
)

func run() error {
	var err error
	os.Args[0] = "mstored"
	util := starter.NewStarter()
	if err != nil {
		return err
	}

	cmd := util.GetCmd()
	now := time.Now()
	header := &doc.GenManHeader{
		Title:   "mstored",
		Section: "8",
		Manual:  "User commands",
		Source:  "mstored command",
		Date:    &now,
	}
	opts := doc.GenManTreeOptions{
		Header:           header,
		Path:             "./",
		CommandSeparator: "-",
	}
	err = doc.GenManTreeFromOpts(cmd, opts)
	if err != nil {
		return err
	}
	return err
}

func main() {
	err := run()
	if err != nil {
		fmt.Printf("err: %v\n", err)
	}

}
