diff --git a/cmd/neofs-cli/modules/container.go b/cmd/neofs-cli/modules/container.go index 8d630d9a..56e040ba 100644 --- a/cmd/neofs-cli/modules/container.go +++ b/cmd/neofs-cli/modules/container.go @@ -83,6 +83,7 @@ var containerCmd = &cobra.Command{ // bind exactly that cmd's flags to // the viper before execution bindCommonFlags(cmd) + bindAPIFlags(cmd) }, } diff --git a/cmd/neofs-cli/modules/netmap.go b/cmd/neofs-cli/modules/netmap.go index 79e1ad2d..c8aac1b8 100644 --- a/cmd/neofs-cli/modules/netmap.go +++ b/cmd/neofs-cli/modules/netmap.go @@ -26,6 +26,7 @@ var netmapCmd = &cobra.Command{ // bind exactly that cmd's flags to // the viper before execution bindCommonFlags(cmd) + bindAPIFlags(cmd) }, } diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index c69a02a9..785c3501 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -46,6 +46,7 @@ var ( // bind exactly that cmd's flags to // the viper before execution bindCommonFlags(cmd) + bindAPIFlags(cmd) }, } diff --git a/cmd/neofs-cli/modules/root.go b/cmd/neofs-cli/modules/root.go index 7cf1bb68..38f60072 100644 --- a/cmd/neofs-cli/modules/root.go +++ b/cmd/neofs-cli/modules/root.go @@ -28,8 +28,6 @@ const ( envPrefix = "NEOFS_CLI" ) -const xHeadersFlag = "xhdr" - var xHeaders []string // Global scope flags. @@ -402,3 +400,10 @@ func bindCommonFlags(cmd *cobra.Command) { _ = viper.BindPFlag(rpc, ff.Lookup(rpc)) _ = viper.BindPFlag(verbose, ff.Lookup(verbose)) } + +func bindAPIFlags(cmd *cobra.Command) { + ff := cmd.Flags() + + _ = viper.BindPFlag(ttl, ff.Lookup(ttl)) + _ = viper.BindPFlag(xHeadersKey, ff.Lookup(xHeadersKey)) +} diff --git a/cmd/neofs-cli/modules/storagegroup.go b/cmd/neofs-cli/modules/storagegroup.go index 72de1ccd..2bf17e38 100644 --- a/cmd/neofs-cli/modules/storagegroup.go +++ b/cmd/neofs-cli/modules/storagegroup.go @@ -24,6 +24,7 @@ var storagegroupCmd = &cobra.Command{ // bind exactly that cmd's flags to // the viper before execution bindCommonFlags(cmd) + bindAPIFlags(cmd) }, }