shell

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package shell provides utilities for detecting and configuring user shells, particularly for managing PATH modifications during Grove onboarding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles shell configuration interactions

func NewManager

func NewManager() (*Manager, error)

NewManager creates a new shell manager

func (*Manager) AddToPath

func (m *Manager) AddToPath(dir string) error

AddToPath adds the given directory to the user's shell PATH configuration. It detects the shell type, finds the appropriate RC file, and appends the necessary export line if the directory isn't already configured.

func (*Manager) Detect

func (m *Manager) Detect() (ShellType, error)

Detect returns the user's current shell type based on the SHELL environment variable

func (*Manager) GetPathExportLine

func (m *Manager) GetPathExportLine(dir string, shell ShellType) string

GetPathExportLine returns the shell-specific line to add a directory to PATH

func (*Manager) GetRcFile

func (m *Manager) GetRcFile(shell ShellType) (string, error)

GetRcFile returns the appropriate RC file path for the given shell type

func (*Manager) GetRcFileName

func (m *Manager) GetRcFileName(shell ShellType) string

GetRcFileName returns the file name (not full path) of the RC file

func (*Manager) GetShellName

func (m *Manager) GetShellName(shell ShellType) string

GetShellName returns a human-readable name for the shell type

func (*Manager) PathIncludes

func (m *Manager) PathIncludes(dir string) bool

PathIncludes checks if the given directory is already in the user's PATH

type ShellType

type ShellType string

ShellType represents a supported shell type

const (
	ShellBash ShellType = "bash"
	ShellZsh  ShellType = "zsh"
	ShellFish ShellType = "fish"
)

Jump to

Keyboard shortcuts

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