shell

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompletionInstallPath

func CompletionInstallPath(sh Shell) (string, error)

CompletionInstallPath returns the filesystem path where completion scripts should be installed for the given shell. On macOS with Homebrew (detected via HOMEBREW_PREFIX), uses Homebrew directories for bash and zsh. Otherwise uses XDG-based defaults. Returns an error if the user's home directory cannot be determined when needed (i.e., when no XDG/Homebrew override is set).

func GenerateActivationScript

func GenerateActivationScript(sh Shell) (string, error)

GenerateActivationScript returns the shell integration script for the given shell.

func ShellIntegratedCommands

func ShellIntegratedCommands() []string

ShellIntegratedCommands returns the list of commands that require shell integration. These commands output shell code to stdout that must be eval'd by the parent shell.

Types

type Shell

type Shell string

Shell represents a supported shell type.

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

func DetectShell

func DetectShell() Shell

DetectShell detects the current shell from the $SHELL environment variable. Falls back to bash if unrecognized.

func ParseShell

func ParseShell(s string) (Shell, error)

ParseShell converts a string to a Shell type. Returns an error if the shell is not recognized.

Jump to

Keyboard shortcuts

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