mirror of
https://github.com/hanzozt/zt.git
synced 2026-10-30 15:04:55 +00:00
33 lines
865 B
Go
33 lines
865 B
Go
package database
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/openziti/ziti-db-explorer/cmd/ziti-db-explorer/zdecli"
|
|
"github.com/openziti/ziti/ziti/util"
|
|
"github.com/spf13/cobra"
|
|
"io"
|
|
)
|
|
|
|
func NewCmdDb(out io.Writer, errOut io.Writer) *cobra.Command {
|
|
cmd := util.NewEmptyParentCmd("db", "Interact with Ziti database files")
|
|
|
|
exploreCmd := &cobra.Command{
|
|
Use: "explore <ctrl.db>|help|version",
|
|
Short: "Interactive CLI to explore Ziti database files",
|
|
Args: cobra.ExactArgs(1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if err := zdecli.Run("ziti db explore", args[0]); err != nil {
|
|
_, _ = errOut.Write([]byte(fmt.Sprintf("Error: %s", err)))
|
|
}
|
|
},
|
|
}
|
|
|
|
cmd.AddCommand(exploreCmd)
|
|
cmd.AddCommand(NewCompactAction())
|
|
cmd.AddCommand(NewDiskUsageAction())
|
|
cmd.AddCommand(NewAddDebugAdminAction())
|
|
cmd.AddCommand(NewAnonymizeAction())
|
|
|
|
return cmd
|
|
}
|