Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Added pflag support in cli #11

Merged
merged 4 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,19 @@ func NewDataCommand() *cobra.Command {
return command
}

func (r *RootOptions) initConfig(_ *cobra.Command, _ []string) error {
func (r *RootOptions) initConfig(cmd *cobra.Command, _ []string) error {
r.configAccessor = viper.NewAccessor(config.Options{
StrictMode: true,
SearchPaths: []string{r.cfgFile},
})

// persistent flags were initially bound to the root command so we must bind to the same command to avoid
r.configAccessor.InitializePflags(cmd.PersistentFlags())
yindia marked this conversation as resolved.
Show resolved Hide resolved

err := r.configAccessor.UpdateConfig(context.TODO())
if err != nil {
return err
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.13
require (
github.com/aws/aws-sdk-go v1.37.1
github.com/flyteorg/flyteidl v0.18.15
github.com/flyteorg/flytestdlib v0.3.20
github.com/flyteorg/flytestdlib v0.3.30
github.com/fsnotify/fsnotify v1.4.9
github.com/ghodss/yaml v1.0.0
github.com/golang/protobuf v1.4.3
Expand Down
Loading