Documentation ¶
Index ¶
Constants ¶
View Source
const ( SHELL_ENV_VAR = "SHELL" OS_DEFAULT = "bash" )
View Source
const ConfigKeyShell = "shell"
Variables ¶
This section is empty.
Functions ¶
func ConfigureAvailableShells ¶
func ConfigureAvailableShells(shell SubShell, cfg sscommon.Configurable, env map[string]string, identifier sscommon.RcIdentification, userScope bool) error
func DetectShell ¶
func DetectShell(cfg sscommon.Configurable) (string, string)
DetectShell detects the shell relevant to the current process and returns its name and path.
Types ¶
type SubShell ¶
type SubShell interface { // Activate the given subshell Activate(proj *project.Project, cfg sscommon.Configurable, out output.Outputer) error // Errors returns a channel to receive errors Errors() <-chan error // Deactivate the given subshell Deactivate() error // Run a script string, passing the provided command-line arguments, that assumes this shell and returns the exit code Run(filename string, args ...string) error // IsActive returns whether the given subshell is active IsActive() bool // Binary returns the configured binary Binary() string // SetBinary sets the configured binary, this should only be called by the subshell package SetBinary(string) // WriteUserEnv writes the given env map to the users environment WriteUserEnv(sscommon.Configurable, map[string]string, sscommon.RcIdentification, bool) error // CleanUserEnv removes the environment setting identified CleanUserEnv(sscommon.Configurable, sscommon.RcIdentification, bool) error // RemoveLegacyInstallPath removes the install path added to shell configuration by the legacy install scripts RemoveLegacyInstallPath(sscommon.Configurable) error // WriteCompletionScript writes the completions script for the current shell WriteCompletionScript(string) error // RcFile return the path of the RC file RcFile() (string, error) // EnsureRcFile ensures that the RC file exists EnsureRcFileExists() error // SetupShellRcFile writes a script or source-able file that updates the environment variables and sets the prompt SetupShellRcFile(string, map[string]string, *project.Namespaced, sscommon.Configurable) error // Shell returns an identifiable string representing the shell, eg. bash, zsh Shell() string // SetEnv sets the environment up for the given subshell SetEnv(env map[string]string) error // Quote will quote the given string, escaping any characters that need escaping Quote(value string) string // IsAvailable returns whether the shell is available on the system IsAvailable() bool }
SubShell defines the interface for our virtual environment packages, which should be contained in a sub-directory under the same directory as this file
func New ¶
func New(cfg sscommon.Configurable) SubShell
New returns the subshell relevant to the current process, but does not activate it
Click to show internal directories.
Click to hide internal directories.