{"modulePath":"github.com/windsorcli/cli","version":"v0.1.5","isLatest":false,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package shell\n\n## Types\n\n```go\ntype DefaultShell struct {\n\t// contains filtered or unexported fields\n}\n```\nDefaultShell is the default implementation of the Shell interface\n\n```go\nfunc NewDefaultShell(injector di.Injector) *DefaultShell\n```\nNewDefaultShell creates a new instance of DefaultShell\n\n```go\nfunc (s *DefaultShell) Exec(command string, args ...string) (string, error)\n```\nExec executes a command and returns its output as a string\n\n```go\nfunc (s *DefaultShell) ExecProgress(message string, command string, args ...string) (string, error)\n```\nExecProgress executes a command and returns its output as a string while displaying progress status\n\n```go\nfunc (s *DefaultShell) ExecSilent(command string, args ...string) (string, error)\n```\nExecSilent executes a command and returns its output as a string without printing to stdout or stderr\n\n```go\nfunc (s *DefaultShell) ExecSudo(message string, command string, args ...string) (string, error)\n```\nExecSudo executes a command with sudo if not already present and returns its output while suppressing it from being printed\n\n```go\nfunc (s *DefaultShell) GetProjectRoot() (string, error)\n```\nGetProjectRoot retrieves the project root directory\n\n```go\nfunc (s *DefaultShell) Initialize() error\n```\nInitialize initializes the shell\n\n```go\nfunc (s *DefaultShell) PrintAlias(aliases map[string]string) error\n```\nPrintAlias prints the aliases for the shell.\n\n```go\nfunc (s *DefaultShell) PrintEnvVars(envVars map[string]string) error\n```\nPrintEnvVars prints the provided environment variables in a sorted order. If the value of an environment variable is an empty string, it will print an unset command.\n\n```go\ntype MockShell struct {\n\tDefaultShell\n\tInitializeFunc     func() error\n\tPrintEnvVarsFunc   func(envVars map[string]string) error\n\tPrintAliasFunc     func(envVars map[string]string) error\n\tGetProjectRootFunc func() (string, error)\n\tExecFunc           func(command string, args ...string) (string, error)\n\tExecSilentFunc     func(command string, args ...string) (string, error)\n\tExecProgressFunc   func(message string, command string, args ...string) (string, error)\n\tExecSudoFunc       func(message string, command string, args ...string) (string, error)\n}\n```\nMockShell is a struct that simulates a shell environment for testing purposes.\n\n```go\nfunc NewMockShell(injectors ...di.Injector) *MockShell\n```\nNewMockShell creates a new instance of MockShell. If injector is provided, it sets the injector on MockShell.\n\n```go\nfunc (s *MockShell) Exec(command string, args ...string) (string, error)\n```\nExec calls the custom ExecFunc if provided.\n\n```go\nfunc (s *MockShell) ExecProgress(message string, command string, args ...string) (string, error)\n```\nExecProgress calls the custom ExecProgressFunc if provided.\n\n```go\nfunc (s *MockShell) ExecSilent(command string, args ...string) (string, error)\n```\nExecSilent calls the custom ExecSilentFunc if provided.\n\n```go\nfunc (s *MockShell) ExecSudo(message string, command string, args ...string) (string, error)\n```\nExecSudo calls the custom ExecSudoFunc if provided.\n\n```go\nfunc (s *MockShell) GetProjectRoot() (string, error)\n```\nGetProjectRoot calls the custom GetProjectRootFunc if provided.\n\n```go\nfunc (s *MockShell) Initialize() error\n```\nInitialize calls the custom InitializeFunc if provided.\n\n```go\nfunc (s *MockShell) PrintAlias(envVars map[string]string) error\n```\nPrintAlias calls the custom PrintAliasFunc if provided.\n\n```go\nfunc (s *MockShell) PrintEnvVars(envVars map[string]string) error\n```\nPrintEnvVars calls the custom PrintEnvVarsFunc if provided.\n\n```go\ntype SecureShell struct {\n\tDefaultShell\n\t// contains filtered or unexported fields\n}\n```\nSecureShell implements the Shell interface using SSH.\n\n```go\nfunc NewSecureShell(injector di.Injector) *SecureShell\n```\nNewSecureShell creates a new instance of SecureShell.\n\n```go\nfunc (s *SecureShell) Exec(command string, args ...string) (string, error)\n```\nExec executes a command on the remote host via SSH and returns its output as a string.\n\n```go\nfunc (s *SecureShell) ExecProgress(message string, command string, args ...string) (string, error)\n```\nExecProgress executes a command and returns its output as a string\n\n```go\nfunc (s *SecureShell) ExecSilent(command string, args ...string) (string, error)\n```\nExecSilent executes a command and returns its output as a string without printing to stdout or stderr\n\n```go\nfunc (s *SecureShell) Initialize() error\n```\nInitialize initializes the SecureShell instance.\n\n```go\ntype Shell interface {\n\tInitialize() error\n\t// PrintEnvVars prints the provided environment variables\n\tPrintEnvVars(envVars map[string]string) error\n\t// PrintAlias retrieves the shell alias\n\tPrintAlias(envVars map[string]string) error\n\t// GetProjectRoot retrieves the project root directory\n\tGetProjectRoot() (string, error)\n\t// Exec executes a command with optional privilege elevation\n\tExec(command string, args ...string) (string, error)\n\t// ExecSilent executes a command and returns its output as a string without printing to stdout or stderr\n\tExecSilent(command string, args ...string) (string, error)\n\t// ExecSudo executes a command with sudo if not already present and returns its output as a string while suppressing it from being printed\n\tExecSudo(message string, command string, args ...string) (string, error)\n\t// ExecProgress executes a command and returns its output as a string while displaying progress status\n\tExecProgress(message string, command string, args ...string) (string, error)\n}\n```\nShell interface defines methods for shell operations\n\n","path":"github.com/windsorcli/cli/internal/shell","name":"shell","synopsis":"","isRedistributable":true}
