versions

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteVersionFilePattern string = "https://raw.githubusercontent.com/gvcgo/resources/main/%s.version.json"
)

Variables

View Source
var ArchHandlerList = map[string]func(archType, osType string) string{
	"gradle":     ToAnyArch,
	"gsudo":      ToAnyArch,
	"maven":      ToAnyArch,
	"neovim":     ToUniverseForMac,
	"python":     ToAnyArch,
	"rust":       ToAnyArch,
	"sdkmanager": ToAnyArch,
	"vscode":     ToDarwinX64,
	"scala":      ToAnyArch,
}
View Source
var OsHandlerList = map[string]func(archType, osType string) string{
	"gradle": ToAnyOs,
	"gsudo":  ToWindowsOnly,
	"maven":  ToAnyOs,
	"python": ToAnyOs,
	"rust":   ToUnixOs,
	"scala":  ToAnyOs,
}

Functions

func QuickSort

func QuickSort(iList []Item, ascend bool) (r []string)

func SortStringList

func SortStringList(sl []string) []string

func SortVersion

func SortVersion(vs []string) []string

Sorts version list

func ToAnyArch

func ToAnyArch(archType, osType string) string

Arch handler

func ToAnyOs

func ToAnyOs(archType, osType string) string

Os handler

func ToDarwinX64

func ToDarwinX64(archType, osType string) string

func ToUniverseForMac

func ToUniverseForMac(archType, osType string) string

func ToUnixArch

func ToUnixArch(archType, osType string) string

func ToUnixOs

func ToUnixOs(archType, osType string) string

func ToWindowsOnly

func ToWindowsOnly(archType, osType string) string

Types

type Item

type Item interface {
	Greater(Item) bool
	String() string
}

General QuickSort

type StringComparator

type StringComparator struct {
	Origin string
}

func (*StringComparator) Greater

func (sc *StringComparator) Greater(item Item) bool

func (*StringComparator) String

func (sc *StringComparator) String() string

type VersionComparator

type VersionComparator struct {
	Major  int
	Minor  int
	Patch  int
	Beta   int
	RC     int
	Origin string
}

Version Comparator

func (*VersionComparator) Greater

func (ver *VersionComparator) Greater(item Item) bool

func (*VersionComparator) String

func (ver *VersionComparator) String() string

type VersionInfo

type VersionInfo struct {
	List        map[string]VersionList // full version list
	CurrentList map[string]VersionList // version list for current Arch and Os.
	AppName     string                 // name in AppList

	ArchHandler func(archType, osType string) string
	OsHandler   func(archType, osType string) string
	// contains filtered or unexported fields
}

func NewVInfo

func NewVInfo(appName string) (vi *VersionInfo)

func (*VersionInfo) GetSortedVersionList

func (v *VersionInfo) GetSortedVersionList() (r []string)

func (*VersionInfo) GetVersions

func (v *VersionInfo) GetVersions() map[string]VersionList

func (*VersionInfo) Parse

func (v *VersionInfo) Parse()

func (*VersionInfo) RegisterArchHandler

func (v *VersionInfo) RegisterArchHandler(f func(archType, osType string) string)

func (*VersionInfo) RegisterOsHandler

func (v *VersionInfo) RegisterOsHandler(f func(archType, osType string) string)

type VersionItem

type VersionItem struct {
	Url     string `json:"Url"`
	Arch    string `json:"Arch"`
	Os      string `json:"Os"`
	Sum     string `json:"Sum"`
	SumType string `json:"SumType"`
	Extra   string `json:"Extra"`
}

type VersionList

type VersionList []VersionItem

Jump to

Keyboard shortcuts

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