Documentation
¶
Index ¶
- func AddEventsSubCmds(rootCmd *cobra.Command, cfg *config.Config) error
- func AddTerminalSubCmds(rootCmd *cobra.Command, cfg *config.Config) error
- func ExtractAppsArgs(osArgs []string) []string
- func ExtractCommandArgs(osArgs []string, commandName string) []string
- func GetAliases() map[string]string
- func GetCmdAlias(principle string) string
- func GetResourceCmdName(name string) string
- func HandleResourcePluginConflict(rootCmd *cobra.Command, cfg *config.Config, commandName string) error
- func HideAliasedCommands(rootCmd *cobra.Command)
- func NewQuickstartCmd(parentCmd *cobra.Command, config *config.Config)
- func NewUnsupportedV2BillingOperationCmd(parentCmd *cobra.Command, name string, path string) *cobra.Command
- func PostProcessResourceCommands(rootCmd *cobra.Command, cfg *config.Config) error
- func TryAppsPlugin(cfg *config.Config, args []string) error
- func TryPlugin(cfg *config.Config, pluginName string, args []string) error
- type EventsResendCmd
- type NamespaceCmd
- type OperationCmd
- type QuickstartCmd
- type ResourceCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEventsSubCmds ¶ added in v0.7.5
AddEventsSubCmds adds custom subcommands to the `events` command created automatically as a resource command.
func AddTerminalSubCmds ¶ added in v1.4.0
AddTerminalSubCmds adds custom subcommands to the `terminal` command created automatically as a resource command.
func ExtractAppsArgs ¶ added in v1.37.5
ExtractAppsArgs extracts the arguments after "apps" from os.Args
func ExtractCommandArgs ¶ added in v1.37.5
ExtractCommandArgs extracts the arguments after the specified command from os.Args
func GetAliases ¶ added in v1.22.0
GetAliases retrieves the entire alias map, useful for testing
func GetCmdAlias ¶ added in v1.22.0
GetCmdAlias retrieves the alias for a given resource, if one is present; otherwise returns ""
func GetResourceCmdName ¶
GetResourceCmdName returns the name for the resource commands. This differs from the resource name because we want to use the pluralized name in most cases.
func HandleResourcePluginConflict ¶ added in v1.37.5
func HandleResourcePluginConflict(rootCmd *cobra.Command, cfg *config.Config, commandName string) error
HandleResourcePluginConflict is called during initialization to set up resource/plugin command handling. It modifies the resource command to intercept unknown subcommands and delegate to the plugin.
This should only be called when the plugin is confirmed to be installed.
func HideAliasedCommands ¶ added in v1.22.0
HideAliasedCommands performs the post-processing on the command tree to hide resources that have an alias
func NewQuickstartCmd ¶ added in v1.4.0
NewQuickstartCmd returns a new terminal quickstart command
func NewUnsupportedV2BillingOperationCmd ¶ added in v1.21.6
func NewUnsupportedV2BillingOperationCmd(parentCmd *cobra.Command, name string, path string) *cobra.Command
NewUnsupportedV2BillingOperationCmd returns a new cobra command for an unsupported v2 billing command. This is temporary until resource commands support the /v2/billing namespace.
func PostProcessResourceCommands ¶ added in v1.12.0
PostProcessResourceCommands patches up generated resource commands
func TryAppsPlugin ¶ added in v1.37.5
TryAppsPlugin attempts to run the apps plugin with the given args
func TryPlugin ¶ added in v1.37.5
TryPlugin attempts to run the specified plugin with the given args. Returns nil if plugin exists and executed successfully. Returns error if plugin doesn't exist (so caller can show default error). Exits directly with os.Exit(1) if plugin exists but fails (plugin prints its own error).
Types ¶
type EventsResendCmd ¶ added in v0.7.5
type EventsResendCmd struct {
// contains filtered or unexported fields
}
EventsResendCmd represents the event resend API operation command. This command is manually defined because it has a custom behavior.
func NewEventsResendCmd ¶ added in v0.7.5
func NewEventsResendCmd(parentCmd *cobra.Command, cfg *config.Config) *EventsResendCmd
NewEventsResendCmd returns a new EventsResendCmd.
type NamespaceCmd ¶
type NamespaceCmd struct {
Cmd *cobra.Command
Name string
ResourceCmds map[string]*ResourceCmd
}
NamespaceCmd represents namespace commands. Namespace commands are top-level commands that are simply containers for resource commands.
Example of namespaces: `issuing`, `radar`, `terminal`.
func NewNamespaceCmd ¶
func NewNamespaceCmd(rootCmd *cobra.Command, namespaceName string) *NamespaceCmd
NewNamespaceCmd returns a new NamespaceCmd.
type OperationCmd ¶
type OperationCmd struct {
*requests.Base
Name string
HTTPVerb string
Path string
URLParams []string
IsPreviewCommand bool
// contains filtered or unexported fields
}
OperationCmd represents operation commands. Operation commands are nested under resource commands and represent a specific API operation for that resource.
Examples of operations: `create`, `retrieve` (standard CRUD methods), `capture` (custom method for the `charges` resource).
func NewOperationCmd ¶
func NewOperationCmd(parentCmd *cobra.Command, name, path, httpVerb string, propFlags map[string]string, enumFlags map[string][]spec.StripeEnumValue, cfg *config.Config, isPreview bool, serverURL string) *OperationCmd
NewOperationCmd returns a new OperationCmd.
type QuickstartCmd ¶ added in v1.4.0
type QuickstartCmd struct {
// contains filtered or unexported fields
}
QuickstartCmd starts a prompt flow for connecting a Terminal reader to their Stripe account
type ResourceCmd ¶
type ResourceCmd struct {
Cmd *cobra.Command
Name string
OperationCmds map[string]*OperationCmd
}
ResourceCmd represents resource commands. Resource commands can be either top-level commands or nested under namespace commands. Resource commands are containers for operation commands.
Example of resources: `customers`, `payment_intents` (top-level, not namespaced), `early_fraud_warnings` (namespaced under `radar`).
func NewResourceCmd ¶
func NewResourceCmd(parentCmd *cobra.Command, resourceName string) *ResourceCmd
NewResourceCmd returns a new ResourceCmd.