Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckWritable ¶
CheckWritable verifies that the running process can replace the binary at targetPath by probing the parent directory. os.Rename only requires write permission on the parent directory, not on the target file itself.
func ResolveExecutable ¶
ResolveExecutable returns the path of the current binary with symlinks resolved. Callers use the resolved path consistently for permission checks, user-facing messages, and the rename target.
func SelfReplace ¶
SelfReplace downloads the release asset for the given tag and replaces the binary at targetPath in place. Only supported on linux and darwin. Callers should resolve symlinks before invoking so the rename targets the real binary.
Types ¶
type Method ¶
type Method int
Method describes how the CLI was installed.
const ( // MethodBinary is a standalone binary (install.sh, manual download, or unknown). MethodBinary Method = iota // MethodBrew is a Homebrew cask install. MethodBrew // MethodNix is a Nix install (binary lives in the read-only /nix/store). MethodNix // MethodGoInstall is a `go install` install. MethodGoInstall )
func DetectInstallMethod ¶
func DetectInstallMethod() Method
DetectInstallMethod inspects the running binary's path and environment to guess how the CLI was installed.