Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executable ¶
type Executable interface { // BinaryPath returns the current binary path of the executable. BinaryPath() (string, error) }
Executable defines an abstraction over the current binary executable.
type ExecutableFn ¶
ExecutableFn is used to return the current binary path, so that we know which application to call when inserting the completion command.
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer represents a series of different shell installers. Calling Install and Uninstall to add and remove the correct shell installer commands retrospectively.
func New ¶
func New(options ...InstallerOption) (*Installer, error)
New creates a new installer with the correct dependencies and sane defaults. Returns an error if it can't locate the correct binary path.
type InstallerOption ¶
type InstallerOption func(InstallerOptions)
InstallerOption captures a tweak that can be applied to the Installer.
func OptionExecutable ¶
func OptionExecutable(exec Executable) InstallerOption
OptionExecutable allows the setting and appending of a exec option to configure the installer.
func OptionShell ¶
func OptionShell(shell *Shell) InstallerOption
OptionShell allows the setting and appending of a shell option to configure the installer.
type InstallerOptions ¶
type InstallerOptions interface { AppendShell(*Shell) SetExecutable(Executable) }
InstallerOptions represents a way to set optional values to a installer option. The InstallerOptions shows what options are available to change.
type OSExecutable ¶
type OSExecutable struct{}
OSExecutable is a wrapper around the OS package to provide the binary path for the current executable.
func (OSExecutable) BinaryPath ¶
func (e OSExecutable) BinaryPath() (string, error)
BinaryPath returns the binary path as an absolute file path.
type OSUser ¶
type OSUser struct {
// contains filtered or unexported fields
}
OSUser represents a current operating system user.
func CurrentUser ¶
CurrentUser returns the current operating system user. If there is an error trying to get the current user, it returns an error.
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell represents a shell for installing and uninstalling autocomplete commands in the correct shell files.
func Bash ¶
func Bash(options ...ShellOption) *Shell
Bash creates a new Shell with the file locations and the correct bash complete command.
func Zsh ¶
func Zsh(options ...ShellOption) *Shell
Zsh creates a new Shell with the file locations and the correct zsh complete command.
type ShellOption ¶
type ShellOption func(ShellOptions)
ShellOption captures a tweak that can be applied to the Shell.
func OptionFileSystem ¶
func OptionFileSystem(fs fsys.FileSystem) ShellOption
OptionFileSystem allows the setting a filesystem option to configure the shell.
func OptionUser ¶
func OptionUser(u User) ShellOption
OptionUser allows the setting a user option to configure the shell.
type ShellOptions ¶
type ShellOptions interface { SetFileSystem(fsys.FileSystem) SetUser(User) }
ShellOptions represents a way to set optional values to a installer option. The ShellOptions shows what options are available to change.