Skip to content

Commit

Permalink
move operations with path "/v1/test_helpers/*" to test_helpers namesp…
Browse files Browse the repository at this point in the history
…ace (#965)

* move operations with path "/v1/test_helpers" to test_helpers top command

* also add test_helpers as a subresource to original commands

* fix typo

* disable goconst
  • Loading branch information
etsai-stripe committed Sep 6, 2022
1 parent 10bceb0 commit 05ecf95
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 110 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ linters:
- dogsled
- dupl
- exportloopref
- goconst
- gocritic
- gocyclo
- gofmt
Expand Down
35 changes: 35 additions & 0 deletions pkg/cmd/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/spf13/cobra"

"github.com/stripe/stripe-cli/pkg/ansi"
"github.com/stripe/stripe-cli/pkg/config"
)

//
Expand Down Expand Up @@ -42,6 +43,14 @@ func GetResourceCmdName(name string) string {
return "3d_secure"
case "usage_record_summary":
return "usage_record_summaries"
case "test_helpers":
return "test_helpers"
case "treasury":
return "treasury"
case "issuing":
return "issuing"
case "terminal":
return "terminal"
default:
return name + "s"
}
Expand Down Expand Up @@ -103,3 +112,29 @@ Use "{{.CommandPath}} [command] --help" for more information about a command.{{e
ansi.Bold("Additional help topics:"),
)
}

// PostProcessResourceCommands patches up generated resource commands
func PostProcessResourceCommands(rootCmd *cobra.Command, cfg *config.Config) error {
err := AddEventsSubCmds(rootCmd, cfg)
if err != nil {
return err
}

err = AddTerminalSubCmds(rootCmd, cfg)
if err != nil {
return err
}

err = AddOrdersSubCmds(rootCmd, cfg)
if err != nil {
return err
}

// remove autogenerated apps command
err = RemoveAppsCmd(rootCmd)
if err != nil {
return err
}

return nil
}
Loading

0 comments on commit 05ecf95

Please sign in to comment.