shellhook

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Path    string
	Updated bool // false = already present (Add) or line not found (Remove)
}

Result describes what happened to a single profile file.

func Add

func Add(line, comment string) ([]Result, error)

Add appends comment and line to the detected shell's primary profile. Only one profile is written to avoid duplication on platforms where multiple profiles are sourced in the same session (e.g. Git Bash sources both .bashrc and .bash_profile). Falls back to the first existing candidate if the shell cannot be detected.

func Remove

func Remove(line, comment string) ([]Result, error)

Remove strips every occurrence of line (full-line match) and any immediately preceding line equal to comment from all existing profiles. Returns one Result per candidate profile found on disk.

type Shell added in v0.0.10

type Shell int

Shell identifies a shell type.

const (
	ShellUnknown Shell = iota
	ShellPowerShell
	ShellBash
	ShellZsh
)

Jump to

Keyboard shortcuts

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