{"modulePath":"github.com/windsorcli/cli","version":"v0.2.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package context\n\n## Types\n\n```go\ntype BaseContextHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nBaseContextHandler implements the ContextHandlerInterface\n\n```go\nfunc NewContextHandler(injector di.Injector) *BaseContextHandler\n```\nNewContextHandler creates a new ContextHandler instance\n\n```go\nfunc (c *BaseContextHandler) Clean() error\n```\nClean cleans up context specific artifacts\n\n```go\nfunc (c *BaseContextHandler) GetConfigRoot() (string, error)\n```\nGetConfigRoot retrieves the configuration root path based on the current context\n\n```go\nfunc (c *BaseContextHandler) GetContext() string\n```\nGetContext retrieves the current context from the configuration\n\n```go\nfunc (c *BaseContextHandler) Initialize() error\n```\nInitialize initializes the context handler\n\n```go\nfunc (c *BaseContextHandler) SetContext(context string) error\n```\nSetContext sets the current context in the configuration and saves it\n\n```go\ntype ContextHandler interface {\n\tInitialize() error\n\tGetContext() string              // Retrieves the current context\n\tSetContext(context string) error // Sets the current context\n\tGetConfigRoot() (string, error)  // Retrieves the configuration root path\n\tClean() error                    // Cleans up context specific artifacts\n}\n```\nContextHandlerInterface defines the interface for context operations\n\n```go\ntype MockContext struct {\n\tInitializeFunc    func() error               // Function to mock Initialize\n\tGetContextFunc    func() string              // Function to mock GetContext\n\tSetContextFunc    func(context string) error // Function to mock SetContext\n\tGetConfigRootFunc func() (string, error)     // Function to mock GetConfigRoot\n\tCleanFunc         func() error               // Function to mock Clean\n}\n```\nMockContext is a mock implementation of the ContextInterface\n\n```go\nfunc NewMockContext() *MockContext\n```\nNewMockContext creates a new instance of MockContext\n\n```go\nfunc (m *MockContext) Clean() error\n```\nClean calls the mock CleanFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockContext) GetConfigRoot() (string, error)\n```\nGetConfigRoot calls the mock GetConfigRootFunc if set, otherwise returns a reasonable default config root and nil error\n\n```go\nfunc (m *MockContext) GetContext() string\n```\nGetContext calls the mock GetContextFunc if set, otherwise returns a reasonable default context and nil error\n\n```go\nfunc (m *MockContext) Initialize() error\n```\nInitialize calls the mock InitializeFunc if set, otherwise returns nil\n\n```go\nfunc (m *MockContext) SetContext(context string) error\n```\nSetContext calls the mock SetContextFunc if set, otherwise returns nil\n\n","path":"github.com/windsorcli/cli/pkg/context","name":"context","synopsis":"","isRedistributable":true}
