Skip to content

Commit

Permalink
fix: rebind projKey flag to update subcommand (#62)
Browse files Browse the repository at this point in the history
* rebind projKey flag to update subcommand

* bind projKey flag to create flag also
  • Loading branch information
k3llymariee authored Mar 25, 2024
1 parent 8883281 commit 1f0f898
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/flags/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func runCreate(cmd *cobra.Command, args []string) error {
viper.GetString("baseUri"),
)

// rebind flag to this subcommand
viper.BindPFlag("projKey", cmd.Flags().Lookup("projKey"))

var data inputData
err := json.Unmarshal([]byte(cmd.Flags().Lookup("data").Value.String()), &data)
// err := json.Unmarshal([]byte(viper.GetString("data")), &data)
Expand Down
3 changes: 3 additions & 0 deletions cmd/flags/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ func runUpdate(cmd *cobra.Command, args []string) error {
viper.GetString("baseUri"),
)

// rebind flag to this subcommand
viper.BindPFlag("projKey", cmd.Flags().Lookup("projKey"))

var patch []ldapi.PatchOperation
// err := json.Unmarshal([]byte(viper.GetString("data")), &patch)
err := json.Unmarshal([]byte(cmd.Flags().Lookup("data").Value.String()), &patch)
Expand Down

0 comments on commit 1f0f898

Please sign in to comment.