forked from TrueCloudLab/frostfs-node
[#854] cli: Do not use global flags
Also delete `ttl` and `xhdr` flags from `accounting balance` command and refactor command initialization. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
4ccb3d05d8
commit
8c59ade4ed
8 changed files with 562 additions and 219 deletions
|
@ -53,6 +53,41 @@ var (
|
|||
|
||||
var netmapStatus string
|
||||
|
||||
func initControlHealthCheckCmd() {
|
||||
initCommonFlags(healthCheckCmd)
|
||||
|
||||
healthCheckCmd.Flags().BoolVar(&healthCheckIRVar, healthcheckIRFlag, false, "Communicate with IR node")
|
||||
}
|
||||
|
||||
func initControlSetNetmapStatusCmd() {
|
||||
initCommonFlags(setNetmapStatusCmd)
|
||||
|
||||
setNetmapStatusCmd.Flags().StringVarP(&netmapStatus, netmapStatusFlag, "", "",
|
||||
fmt.Sprintf("new netmap status keyword ('%s', '%s')",
|
||||
netmapStatusOnline,
|
||||
netmapStatusOffline,
|
||||
),
|
||||
)
|
||||
|
||||
_ = setNetmapStatusCmd.MarkFlagRequired(netmapStatusFlag)
|
||||
}
|
||||
|
||||
func initControlDropObjectsCmd() {
|
||||
initCommonFlags(dropObjectsCmd)
|
||||
|
||||
dropObjectsCmd.Flags().StringSliceVarP(&dropObjectsList, dropObjectsFlag, "o", nil,
|
||||
"List of object addresses to be removed in string format")
|
||||
|
||||
_ = dropObjectsCmd.MarkFlagRequired(dropObjectsFlag)
|
||||
}
|
||||
|
||||
func initControlSnapshotCmd() {
|
||||
initCommonFlags(snapshotCmd)
|
||||
|
||||
snapshotCmd.Flags().BoolVar(&netmapSnapshotJSON, "json", false,
|
||||
"print netmap structure in JSON format")
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(controlCmd)
|
||||
|
||||
|
@ -63,24 +98,10 @@ func init() {
|
|||
snapshotCmd,
|
||||
)
|
||||
|
||||
setNetmapStatusCmd.Flags().StringVarP(&netmapStatus, netmapStatusFlag, "", "",
|
||||
fmt.Sprintf("new netmap status keyword ('%s', '%s')",
|
||||
netmapStatusOnline,
|
||||
netmapStatusOffline,
|
||||
),
|
||||
)
|
||||
|
||||
_ = setNetmapStatusCmd.MarkFlagRequired(netmapStatusFlag)
|
||||
|
||||
dropObjectsCmd.Flags().StringSliceVarP(&dropObjectsList, dropObjectsFlag, "o", nil,
|
||||
"List of object addresses to be removed in string format")
|
||||
|
||||
_ = dropObjectsCmd.MarkFlagRequired(dropObjectsFlag)
|
||||
|
||||
healthCheckCmd.Flags().BoolVar(&healthCheckIRVar, healthcheckIRFlag, false, "Communicate with IR node")
|
||||
|
||||
snapshotCmd.Flags().BoolVar(&netmapSnapshotJSON, "json", false,
|
||||
"print netmap structure in JSON format")
|
||||
initControlHealthCheckCmd()
|
||||
initControlSetNetmapStatusCmd()
|
||||
initControlDropObjectsCmd()
|
||||
initControlSnapshotCmd()
|
||||
}
|
||||
|
||||
func healthCheck(cmd *cobra.Command, _ []string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue