Documentation
¶
Index ¶
- func ActivateHermit(w io.Writer, shell Shell, config ActivationConfig) error
- func DeactivateHermit(w io.Writer, shell Shell, env envars.Envars) error
- func InstallHooks(l *ui.UI, shell Shell) error
- func PrintHooks(shell Shell, sha256sums []string) error
- func Quote(word string) string
- type ActivationConfig
- type Bash
- func (sh *Bash) ActivationHooksCode() (script string, err error)
- func (sh *Bash) ActivationHooksInstallation() (path, script string, err error)
- func (sh *Bash) ActivationScript(w io.Writer, config ActivationConfig) error
- func (sh *Bash) ApplyEnvars(w io.Writer, env envars.Envars) error
- func (sh *Bash) DeactivationScript(w io.Writer) error
- func (sh *Bash) Name() string
- type Changes
- type Shell
- type Zsh
- func (sh *Zsh) ActivationHooksCode() (script string, err error)
- func (sh *Zsh) ActivationHooksInstallation() (path, script string, err error)
- func (sh *Zsh) ActivationScript(w io.Writer, config ActivationConfig) error
- func (sh *Zsh) ApplyEnvars(w io.Writer, env envars.Envars) error
- func (sh *Zsh) DeactivationScript(w io.Writer) error
- func (sh *Zsh) Name() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivateHermit ¶
func ActivateHermit(w io.Writer, shell Shell, config ActivationConfig) error
ActivateHermit prints out the hermit activation script for the given shell.
func DeactivateHermit ¶
DeactivateHermit prints out the hermit deactivation script for the given shell.
func InstallHooks ¶
InstallHooks for the given Shell.
func PrintHooks ¶
PrintHooks for the given shell.
"sha256sums" is the union of all known SHA256 sums for per-environment scripts.
func Quote ¶
Quote returns a word quoted with single-quotes for consumption by shells.
This is necessary because kballard/go-shellquote does not quote leading "=T", which in zsh is for some unfathomable reason equivalent to $(which t) and breaks :( http://zsh.sourceforge.net/Doc/Release/Expansion.html#g_t_0060_003d_0027-expansion
Copied from MIT licensed: https://github.com/kballard/go-shellquote/blob/95032a82bc518f77982ea72343cc1ade730072f0/quote.go#L70
Types ¶
type ActivationConfig ¶ added in v0.2.2
ActivationConfig for shells.
type Bash ¶
type Bash struct {
// contains filtered or unexported fields
}
Bash represent the Bash shell
func (*Bash) ActivationHooksCode ¶
func (*Bash) ActivationHooksInstallation ¶
func (*Bash) ActivationScript ¶
func (sh *Bash) ActivationScript(w io.Writer, config ActivationConfig) error
func (*Bash) DeactivationScript ¶
type Changes ¶
Changes encapsulates changes that need to be applied to the active environment after a change
func NewChanges ¶
NewChanges returns a new empty change set
type Shell ¶
type Shell interface { Name() string // ActivationHooksInstallation returns the path and shell fragment for injecting activation code to the shell initialisation. ActivationHooksInstallation() (path, script string, err error) // ActivationHooksCode returns the shell fragment for activation/deactivation hooks ActivationHooksCode() (script string, err error) // ActivationScript for this shell. ActivationScript(w io.Writer, config ActivationConfig) error // ApplyEnvars writes the shell fragment required to apply the given envars. // // Envars with empty values should be deleted. ApplyEnvars(w io.Writer, env envars.Envars) error // DeactivationScript for this shell. DeactivationScript(w io.Writer) error }
Shell abstracts shell specific functionality
type Zsh ¶
type Zsh struct {
// contains filtered or unexported fields
}
Zsh represents the Zsh shell
func (*Zsh) ActivationHooksCode ¶
func (*Zsh) ActivationHooksInstallation ¶
func (*Zsh) ActivationScript ¶
func (sh *Zsh) ActivationScript(w io.Writer, config ActivationConfig) error