shell

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetShellConfigs

func GetShellConfigs() map[ShellType]ShellConfig

GetShellConfigs returns configurations for different shells

func RemoveEnvironmentVariable

func RemoveEnvironmentVariable(key string) error

RemoveEnvironmentVariable removes an environment variable from all shell configs

func RemoveEnvironmentVariableFromShell

func RemoveEnvironmentVariableFromShell(shellType ShellType, key string) error

RemoveEnvironmentVariableFromShell removes an environment variable from a specific shell

func SetEnvironmentVariable

func SetEnvironmentVariable(key, value string) error

SetEnvironmentVariable sets an environment variable for all detected shells

func SetEnvironmentVariableForShell

func SetEnvironmentVariableForShell(shellType ShellType, key, value string) error

SetEnvironmentVariableForShell sets an environment variable for a specific shell

Types

type ShellConfig

type ShellConfig struct {
	Type        ShellType
	ConfigFile  string
	ExportCmd   string
	SourceCmd   string
	CommentChar string
}

ShellConfig represents shell-specific configuration

type ShellType

type ShellType string

ShellType represents different shell types

const (
	Bash    ShellType = "bash"
	Zsh     ShellType = "zsh"
	Fish    ShellType = "fish"
	Profile ShellType = "profile"
)

func DetectUserShells

func DetectUserShells() ([]ShellType, error)

DetectUserShells detects which shells the user has configured

func GetCurrentShell

func GetCurrentShell() ShellType

GetCurrentShell attempts to detect the current shell

Jump to

Keyboard shortcuts

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