2022-10-10 15:35:40 +00:00
|
|
|
package tree
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Cmd = &cobra.Command{
|
|
|
|
Use: "tree",
|
|
|
|
Short: "Operations with the Tree service",
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
Cmd.AddCommand(addCmd)
|
2022-10-10 18:55:48 +00:00
|
|
|
Cmd.AddCommand(getByPathCmd)
|
2022-10-12 14:48:21 +00:00
|
|
|
Cmd.AddCommand(addByPathCmd)
|
2022-10-10 15:35:40 +00:00
|
|
|
|
|
|
|
initAddCmd()
|
2022-10-10 18:55:48 +00:00
|
|
|
initGetByPathCmd()
|
2022-10-12 14:48:21 +00:00
|
|
|
initAddByPathCmd()
|
2022-10-10 15:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
containerIDFlagKey = "cid"
|
|
|
|
treeIDFlagKey = "tid"
|
|
|
|
parentIDFlagKey = "pid"
|
|
|
|
|
|
|
|
metaFlagKey = "meta"
|
2022-10-10 18:55:48 +00:00
|
|
|
|
|
|
|
pathFlagKey = "path"
|
|
|
|
pathAttributeFlagKey = "pattr"
|
|
|
|
|
|
|
|
latestOnlyFlagKey = "latest"
|
2022-10-10 15:35:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func initCTID(cmd *cobra.Command) {
|
|
|
|
ff := cmd.Flags()
|
|
|
|
|
|
|
|
ff.String(containerIDFlagKey, "", "Container ID")
|
|
|
|
_ = cmd.MarkFlagRequired(containerIDFlagKey)
|
|
|
|
|
|
|
|
ff.String(treeIDFlagKey, "", "Tree ID")
|
|
|
|
_ = cmd.MarkFlagRequired(treeIDFlagKey)
|
|
|
|
}
|