{"modulePath":"github.com/slackapi/slack-cli","version":"v0.0.0-20261130214720-1829e0abe258","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package shared\n\n## Functions\n\n```go\nfunc DebugMode(c *ClientFactory)\n```\nDebugMode is an example of defining a functional options helper\n\n## Types\n\n```go\ntype ClientFactory struct {\n\tAPI          func() api.APIInterface\n\tAppClient    func() *app.Client\n\tAuth         func() auth.AuthInterface\n\tConfig       *config.Config\n\tEventTracker tracking.TrackingManager\n\tHookExecutor hooks.HookExecutor\n\tIO           iostreams.IOStreamer\n\tRuntime      runtime.Runtime\n\tSDKConfig    hooks.SDKCLIConfig\n\n\t// Browser can display or open URLs as webpages on the internet\n\tBrowser func() slackdeps.Browser\n\n\t// Fs is the file system module that's shared by all packages and enables testing \u0026 mock of the file system\n\tFs afero.Fs\n\n\t// Os are a group of operating system functions following the `os` interface that are shared by all packages and enables testing \u0026 mocking\n\tOs types.Os\n\n\t// CleanupWaitGroup is a group of wait groups shared by all packages and allow functions to cleanup before the process terminates\n\tCleanupWaitGroup sync.WaitGroup\n}\n```\nClientFactory are shared clients and configurations for use across the CLI commands (cmd) and handlers (pkg).\n\n```go\nfunc NewClientFactory(options ...func(*ClientFactory)) *ClientFactory\n```\nNewClientFactory creates a new ClientFactory type with the default function handlers\n\n```go\nfunc (c *ClientFactory) InitRuntime(ctx context.Context, dirPath string) error\n```\nInitRuntime initializes a new Runtime instance from the runtime flag or the SDK config or the directory structure\n\n```go\nfunc (c *ClientFactory) InitSDKConfig(ctx context.Context, dirPath string) error\n```\nInitSDKConfig finds and loads hook configurations for a project\n\n```go\nfunc (c *ClientFactory) InitSDKConfigFromJSON(ctx context.Context, configFileBytes []byte) error\n```\nInitSDKConfigFromJSON merges configuration values from the \\`get-hooks\\` hook and the local configuration file\n\n```go\ntype ClientsMock struct {\n\tmock.Mock\n\tAPI          *api.APIMock\n\tAuth         *auth.AuthMock\n\tAppClient    *app.Client\n\tBrowser      *slackdeps.BrowserMock\n\tConfig       *config.Config\n\tEventTracker *tracking.EventTrackerMock\n\tFs           *slackdeps.FsMock\n\tIO           *iostreams.IOStreamsMock\n\tOs           *slackdeps.OsMock\n\tStdout       *bytes.Buffer\n\tHookExecutor hooks.MockHookExecutor\n}\n```\nClientsMock defines mocks that will override aspects of clients for testing purposes.\n\n```go\nfunc NewClientsMock() *ClientsMock\n```\nNewClientsMock will create a new ClientsMock that is ready to be applied to an existing clients with .MockClientFactory().\n\n```go\nfunc (m *ClientsMock) AddDefaultMocks()\n```\nAddDefaultMocks installs the default mock actions to fallback on.\n\n```go\nfunc (m *ClientsMock) GetCombinedOutput() string\n```\nGetCombinedOutput is a helper method to return the combined output of stdout and stderr for testing.\n\n```go\nfunc (m *ClientsMock) GetStderrOutput() string\n```\nGetStderrOutput is a helper method to return the stderr output for testing.\n\n```go\nfunc (m *ClientsMock) GetStdoutOutput() string\n```\nGetStdoutOutput is a helper method to return the stdout output for testing.\n\n```go\nfunc (m *ClientsMock) MockClientFactory() func(c *ClientFactory)\n```\nMockClientFactory is a functional option that installs mocks into a clients instance. Learn more: [https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis](https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis)\n\n","path":"github.com/slackapi/slack-cli/internal/shared","name":"shared","synopsis":"","isRedistributable":true}
