frostfs-node/cmd/frostfs-cli/modules/tree/root.go
Airat Arifullin 189a367ef2
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/push/pre-commit Pipeline was successful
[#390] frostfs-cli: Pass bearer token to Tree srv
* Add --bearer flag for "tree" subcommand

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
2023-06-07 11:08:34 +03:00

49 lines
936 B
Go

package tree
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
"github.com/spf13/cobra"
)
var Cmd = &cobra.Command{
Use: "tree",
Short: "Operations with the Tree service",
}
func init() {
Cmd.AddCommand(addCmd)
Cmd.AddCommand(getByPathCmd)
Cmd.AddCommand(addByPathCmd)
Cmd.AddCommand(listCmd)
initAddCmd()
initGetByPathCmd()
initAddByPathCmd()
initListCmd()
}
const (
treeIDFlagKey = "tid"
parentIDFlagKey = "pid"
metaFlagKey = "meta"
pathFlagKey = "path"
pathAttributeFlagKey = "pattr"
latestOnlyFlagKey = "latest"
bearerFlagKey = "bearer"
)
func initCTID(cmd *cobra.Command) {
ff := cmd.Flags()
ff.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
_ = cmd.MarkFlagRequired(commonflags.CIDFlag)
ff.String(treeIDFlagKey, "", "Tree ID")
_ = cmd.MarkFlagRequired(treeIDFlagKey)
ff.StringP(bearerFlagKey, "", "", "Path to bearer token")
}