Documentation
¶
Index ¶
- func AddJSONFlags(cmd *cobra.Command, flags *JSONFlags)
- func IsAuthError(err error) bool
- func IsSilentError(err error) bool
- func IsTokenTypeError(err error) bool
- func NeedsAuth(f *Factory) func(cmd *cobra.Command, args []string) error
- func NeedsBotToken(f *Factory) func(cmd *cobra.Command, args []string) error
- func NeedsUserToken(f *Factory) func(cmd *cobra.Command, args []string) error
- type AuthError
- type Factory
- type JSONFlags
- type SilentError
- type TokenTypeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddJSONFlags ¶
AddJSONFlags adds --json, --jq, and --template flags to a command.
func IsAuthError ¶
IsAuthError checks if the error is an AuthError.
func IsSilentError ¶
IsSilentError checks if the error is a SilentError.
func IsTokenTypeError ¶
IsTokenTypeError checks if the error is a TokenTypeError.
func NeedsBotToken ¶
NeedsBotToken returns a pre-run function that validates a bot token is available.
Types ¶
type AuthError ¶
type AuthError struct {
Message string
}
AuthError indicates an authentication failure.
type Factory ¶
Factory provides lazy-initialized dependencies to commands.
func NewFactory ¶
NewFactory creates a new Factory with the given IOStreams.
func (*Factory) BotClient ¶
BotClient returns a Slack API client authenticated with the bot token (cached).
func (*Factory) DefaultClient ¶
DefaultClient returns the bot client if available, otherwise the user client.
func (*Factory) IsAgentMode ¶ added in v0.8.0
IsAgentMode returns true when SLACKBUZZ_AGENT=1 is set. Agent mode prefers bot tokens, disables interactive prompts, and outputs structured JSON errors to stderr.
type JSONFlags ¶
JSONFlags holds the --json, --jq, and --template flags.
func (*JSONFlags) OutputJSON ¶
OutputJSON writes data as JSON, optionally filtered by jq or formatted by a template.
type SilentError ¶
type SilentError struct {
Err error
}
SilentError is an error that should not be printed (the command already handled output).
func (*SilentError) Error ¶
func (e *SilentError) Error() string
func (*SilentError) Unwrap ¶
func (e *SilentError) Unwrap() error
type TokenTypeError ¶
TokenTypeError indicates the wrong token type was used.
func (*TokenTypeError) Error ¶
func (e *TokenTypeError) Error() string