[#1074] neofs-cli: Move common API flags to a separate package

TTL and XHeader flags are reused between multiple commands.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-05-30 16:04:40 +03:00 committed by fyrchik
parent 736e09a70d
commit a2bcb3e0ce
6 changed files with 45 additions and 41 deletions

View file

@ -28,7 +28,7 @@ var netmapCmd = &cobra.Command{
// bind exactly that cmd's flags to
// the viper before execution
commonflags.Bind(cmd)
bindAPIFlags(cmd)
commonflags.BindAPI(cmd)
},
}
@ -49,10 +49,7 @@ func init() {
localNodeInfoCmd.Flags().BoolVar(&nodeInfoJSON, "json", false, "print node info in JSON format")
for _, netmapCommand := range netmapChildCommands {
flags := netmapCommand.Flags()
flags.StringSliceVarP(&xHeaders, xHeadersKey, xHeadersShorthand, xHeadersDefault, xHeadersUsage)
flags.Uint32P(ttl, ttlShorthand, ttlDefault, ttlUsage)
commonflags.InitAPI(netmapCommand)
}
}