Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendInit ¶
AppendInit appends the wtf init line to the RC file.
func IsInitPresent ¶
IsInitPresent checks whether the wtf init line is already in the file.
Types ¶
type RCFileManager ¶
type RCFileManager struct {
HomeDir string
}
RCFileManager handles shell RC file operations.
func NewRCFileManager ¶
func NewRCFileManager() (*RCFileManager, error)
NewRCFileManager returns an RCFileManager using the real home directory.
func (*RCFileManager) RCFilePath ¶
func (m *RCFileManager) RCFilePath(shell Shell) (string, error)
RCFilePath returns the RC file path for the given shell.
type ShellDetector ¶
type ShellDetector struct {
// GetEnv returns the value of an environment variable.
GetEnv func(string) string
// ReadParentComm reads the parent process comm file (e.g. /proc/<pid>/comm).
ReadParentComm func(pid int) (string, error)
}
ShellDetector detects the user's current shell.
func NewShellDetector ¶
func NewShellDetector() *ShellDetector
NewShellDetector returns a ShellDetector using real OS functions.