shellpath

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 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

Overview

Package shellpath finds programs as the user's terminal would: on the PATH an interactive login shell sets, which a GUI app or a login item doesn't inherit (Homebrew, the Google Cloud SDK, ~/.local/bin).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdoptUserPath added in v0.5.0

func AdoptUserPath() int

AdoptUserPath gives this process the user's terminal's PATH (see Merge): a service that launchd, systemd or the tray started has the system's bare one, without the folders language servers and tools are installed in (nvm, Homebrew, ~/go/bin). It returns how many folders were added. Windows has no login shell to ask: nothing changes there.

func Find

func Find(name string) string

Find is the program named name on this process's PATH, else on the user's terminal's ("" if on neither).

func LoginShell

func LoginShell() string

LoginShell is the user's shell ($SHELL, else the system's default).

func LookPathIn

func LookPathIn(dirs []string, name string) string

LookPathIn is the first executable file named name in dirs ("" if none), as the shell would find it.

func Merge added in v0.5.0

func Merge(user, own []string) []string

Merge is the user's PATH, in their terminal's order, then this process's folders it lacks; each folder once.

func UserPath

func UserPath(shell string) []string

UserPath is PATH as a new terminal has it: what an interactive login shell prints, else (it fails, or takes over 5 s) this process's PATH. A startup file that leaves a program running with the shell's output open doesn't hold it up past another second: the service's start waits for it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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