utils

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsuppotedCompressFormat = fmt.Errorf("unsupported compress format")

	FvmHome = os.Getenv(consts.FVM_HOME)
)
View Source
var (
	Config      model.Config
	ErrNoConfig = errors.New("No config file")
)
View Source
var (
	ErrVersionNotInstalled = errors.New("Version not installed. Please install it before using.")
	ErrGlobalNotSet        = errors.New("Global version not set. Please set it before using.")
)
View Source
var (
	Shell     ShellType
	RcPath    string
	ShellName string

	ErrShellConfigNotFound = errNone
	ErrUnsupportedShell    = errNone
)

Functions

func AppendIfNotContains added in v0.0.8

func AppendIfNotContains(path string, lines2Add []string) error

func ConfigGitIgnore

func ConfigGitIgnore() error

func ConfigIde

func ConfigIde() error

func ConfigPath

func ConfigPath() error

func Contains

func Contains[T string | int | int64 | float64](list []T, item T) bool

func Delete added in v0.2.2

func Delete(version string) error

func DownloadFile added in v0.2.0

func DownloadFile(url string, dest string) error

func Execute

func Execute(bin string, args ...string) error

func Exists

func Exists(path string) bool

func GetArch

func GetArch() string

func GetConfig

func GetConfig() error

func GetFileHash

func GetFileHash(path string) (string, error)

func GetGlobalVersion added in v0.3.3

func GetGlobalVersion() (string, error)

func GetOS

func GetOS() string

func GetReleaseByVersion

func GetReleaseByVersion(releases []model.Release, version string) (r model.Release, err error)

func GetReleases

func GetReleases() (releases []model.Release, err error)

func GetVersionDir

func GetVersionDir(v string) string

func Global

func Global(version string) error

func Install

func Install(r model.Release, force bool) error
func IsSymlink(name string) (bool, error)

func IsVersionInstalled

func IsVersionInstalled(version string) bool

func JudgeUseMirror added in v0.0.6

func JudgeUseMirror() bool

func SaveConfig

func SaveConfig() error

func SetAlias added in v0.0.6

func SetAlias() error
func Symlink(src, dst string) error

func TestFlutter added in v0.1.1

func TestFlutter() error

func TestFvm added in v0.0.8

func TestFvm() error

func Uncompress

func Uncompress(src, dest string) error

func Use

func Use(v string) error

Types

type ShellType added in v0.0.7

type ShellType uint8
const (
	ShellTypeUnknown ShellType = iota
	ShellTypeBash
	ShellTypeZsh
	ShellTypeFish
)

func GetShell added in v0.0.7

func GetShell() ShellType

func (ShellType) RcPath added in v0.0.7

func (s ShellType) RcPath() string

func (ShellType) String added in v0.0.7

func (s ShellType) String() string

Jump to

Keyboard shortcuts

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