cli

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Copyright 2022 Tristan Isham. All rights reserved. Use of this source code is governed by the MIT license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingBundlePath     = errors.New("bundle download path not found")
	ErrUnsupportedSystem     = errors.New("unsupported system for Zig")
	ErrUnsupportedVersion    = errors.New("unsupported Zig version")
	ErrMissingInstallPathEnv = errors.New("env 'ZVM_INSTALL' is not set")
	ErrFailedUpgrade         = errors.New("failed to self-upgrade zvm")
	ErrInvalidVersionMap     = errors.New("invalid version map format")
)
View Source
var (
	ErrNoSettings = errors.New("settings.json not found")
)

Functions

func CanIUpgrade

func CanIUpgrade() (bool, string, error)

func ExtractBundle

func ExtractBundle(bundle, out string) error

func LoadMasterVersion

func LoadMasterVersion(zigMap *zigVersionMap) string

LoadMasterVersion takes a zigVersionMap and returns the master disto's version if it's present. If it's not, this function returns an empty string.

Types

type GithubRelease

type GithubRelease struct {
	URL       string `json:"url"`
	AssetsURL string `json:"assets_url"`
	UploadURL string `json:"upload_url"`
	HTMLURL   string `json:"html_url"`
	ID        int    `json:"id"`
	Author    struct {
		Login             string `json:"login"`
		ID                int    `json:"id"`
		NodeID            string `json:"node_id"`
		AvatarURL         string `json:"avatar_url"`
		GravatarID        string `json:"gravatar_id"`
		URL               string `json:"url"`
		HTMLURL           string `json:"html_url"`
		FollowersURL      string `json:"followers_url"`
		FollowingURL      string `json:"following_url"`
		GistsURL          string `json:"gists_url"`
		StarredURL        string `json:"starred_url"`
		SubscriptionsURL  string `json:"subscriptions_url"`
		OrganizationsURL  string `json:"organizations_url"`
		ReposURL          string `json:"repos_url"`
		EventsURL         string `json:"events_url"`
		ReceivedEventsURL string `json:"received_events_url"`
		Type              string `json:"type"`
		SiteAdmin         bool   `json:"site_admin"`
	} `json:"author"`
	NodeID          string    `json:"node_id"`
	TagName         string    `json:"tag_name"`
	TargetCommitish string    `json:"target_commitish"`
	Name            string    `json:"name"`
	Draft           bool      `json:"draft"`
	Prerelease      bool      `json:"prerelease"`
	CreatedAt       time.Time `json:"created_at"`
	PublishedAt     time.Time `json:"published_at"`
	Assets          []struct {
		URL      string      `json:"url"`
		ID       int         `json:"id"`
		NodeID   string      `json:"node_id"`
		Name     string      `json:"name"`
		Label    interface{} `json:"label"`
		Uploader struct {
			Login             string `json:"login"`
			ID                int    `json:"id"`
			NodeID            string `json:"node_id"`
			AvatarURL         string `json:"avatar_url"`
			GravatarID        string `json:"gravatar_id"`
			URL               string `json:"url"`
			HTMLURL           string `json:"html_url"`
			FollowersURL      string `json:"followers_url"`
			FollowingURL      string `json:"following_url"`
			GistsURL          string `json:"gists_url"`
			StarredURL        string `json:"starred_url"`
			SubscriptionsURL  string `json:"subscriptions_url"`
			OrganizationsURL  string `json:"organizations_url"`
			ReposURL          string `json:"repos_url"`
			EventsURL         string `json:"events_url"`
			ReceivedEventsURL string `json:"received_events_url"`
			Type              string `json:"type"`
			SiteAdmin         bool   `json:"site_admin"`
		} `json:"uploader"`
		ContentType        string    `json:"content_type"`
		State              string    `json:"state"`
		Size               int       `json:"size"`
		DownloadCount      int       `json:"download_count"`
		CreatedAt          time.Time `json:"created_at"`
		UpdatedAt          time.Time `json:"updated_at"`
		BrowserDownloadURL string    `json:"browser_download_url"`
	} `json:"assets"`
	TarballURL string `json:"tarball_url"`
	ZipballURL string `json:"zipball_url"`
	Body       string `json:"body"`
}

type InstallRequest

type InstallRequest struct {
	Site, Package, Version string
}

func ExtractInstall

func ExtractInstall(input string) InstallRequest

type Settings

type Settings struct {
	UseColor      bool   `json:"useColor"`
	VersionMapUrl string `json:"versionMapUrl,omitempty"`
	// contains filtered or unexported fields
}

func (*Settings) NoColor

func (s *Settings) NoColor()

func (*Settings) ResetVersionMap

func (s *Settings) ResetVersionMap() error

func (*Settings) SetColor

func (s *Settings) SetColor(answer bool)

func (*Settings) SetVersionMapUrl

func (s *Settings) SetVersionMapUrl(versionMapUrl string) error

func (*Settings) ToggleColor

func (s *Settings) ToggleColor()

func (*Settings) YesColor

func (s *Settings) YesColor()

type ZVM

type ZVM struct {
	Settings Settings
	// contains filtered or unexported fields
}

func Initialize

func Initialize() *ZVM

func (*ZVM) Clean

func (z *ZVM) Clean() error

func (*ZVM) Install

func (z *ZVM) Install(version string) error

func (*ZVM) InstallZls

func (z *ZVM) InstallZls(version string) error

func (ZVM) ListRemoteAvailable

func (z ZVM) ListRemoteAvailable() error

func (*ZVM) ListVersions

func (z *ZVM) ListVersions() error

func (*ZVM) Sync

func (z *ZVM) Sync() error

func (*ZVM) Uninstall

func (z *ZVM) Uninstall(ver string) error

func (*ZVM) Upgrade

func (z *ZVM) Upgrade() error

Upgrade will upgrade the system installation of ZVM. I wrote most of it before I remembered that GitHub has an API so expect major refactoring.

func (*ZVM) Use

func (z *ZVM) Use(ver string) error

type ZigOnlVersion

type ZigOnlVersion = map[string][]map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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