setup

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendInit

func AppendInit(rcPath string, shell Shell) error

AppendInit appends the wtf init line to the RC file.

func InitLine

func InitLine(shell Shell) string

InitLine returns the eval line for the given shell.

func IsInitPresent

func IsInitPresent(rcPath string) (bool, error)

IsInitPresent checks whether the wtf init line is already in the file.

func Render

func Render(shell Shell, funcs []ShellFunc) string

Render emits all shell functions for the given shell.

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 Shell

type Shell string

Shell represents a supported shell type.

const (
	Bash Shell = "bash"
	Zsh  Shell = "zsh"
	Fish Shell = "fish"
)

Supported shell types.

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.

func (*ShellDetector) Detect

func (d *ShellDetector) Detect(override string) (Shell, error)

Detect determines the current shell. Priority: override arg → $SHELL env → parent process.

type ShellFunc

type ShellFunc struct {
	Name string
	Bash string // bash/zsh share syntax
	Fish string
}

ShellFunc defines a shell function to be emitted by `wtf init`.

func DefaultFuncs

func DefaultFuncs() []ShellFunc

DefaultFuncs returns the default set of shell functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL