upgrade

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckWritable

func CheckWritable(targetPath string) error

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 LatestTag

func LatestTag(ctx context.Context) (string, error)

LatestTag returns the tag_name of the latest GitHub release of ovhcloud-cli.

func ResolveExecutable

func ResolveExecutable() (string, error)

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

func SelfReplace(ctx context.Context, tag, targetPath string) error

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
	// 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.

func (Method) String

func (m Method) String() string

Jump to

Keyboard shortcuts

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