2022-10-10 15:35:40 +00:00
|
|
|
package tree
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
2022-10-10 15:35:40 +00:00
|
|
|
"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-18 13:41:10 +00:00
|
|
|
Cmd.AddCommand(listCmd)
|
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-18 13:41:10 +00:00
|
|
|
initListCmd()
|
2022-10-10 15:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2022-10-18 11:43:04 +00:00
|
|
|
treeIDFlagKey = "tid"
|
|
|
|
parentIDFlagKey = "pid"
|
2022-10-10 15:35:40 +00:00
|
|
|
|
|
|
|
metaFlagKey = "meta"
|
2022-10-10 18:55:48 +00:00
|
|
|
|
|
|
|
pathFlagKey = "path"
|
|
|
|
pathAttributeFlagKey = "pattr"
|
|
|
|
|
|
|
|
latestOnlyFlagKey = "latest"
|
2023-06-05 15:54:59 +00:00
|
|
|
|
|
|
|
bearerFlagKey = "bearer"
|
2022-10-10 15:35:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func initCTID(cmd *cobra.Command) {
|
|
|
|
ff := cmd.Flags()
|
|
|
|
|
2022-10-18 11:43:04 +00:00
|
|
|
ff.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
|
|
|
|
_ = cmd.MarkFlagRequired(commonflags.CIDFlag)
|
2022-10-10 15:35:40 +00:00
|
|
|
|
|
|
|
ff.String(treeIDFlagKey, "", "Tree ID")
|
|
|
|
_ = cmd.MarkFlagRequired(treeIDFlagKey)
|
2023-06-05 15:54:59 +00:00
|
|
|
|
|
|
|
ff.StringP(bearerFlagKey, "", "", "Path to bearer token")
|
2022-10-10 15:35:40 +00:00
|
|
|
}
|