cache

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Package cache provides read/write access to the Evans's cache file.

All APIs which modify each config elements are provided as top-level functions which begin with Set*. Note that all changes by Set* functions aren't flushed until calling Save() of the returned cache object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Version        string     `toml:"version"`
	UpdateInfo     UpdateInfo `toml:"updateInfo"`
	InstalledBy    MeansType  `default:"" toml:"installedBy"`
	CommandHistory []string   `default:"" toml:"commandHistory"`
}

Cache represents cached items.

func Get

func Get() *Cache

Get returns loaded cache contents. To reduce duplicatd function calls, Get caches the result of Get. See cachedCache comments for more implementation details.

func (*Cache) ClearUpdateInfo added in v0.7.3

func (c *Cache) ClearUpdateInfo() error

ClearUpdateInfo clears c.UpdateInfo. ClearUpdateInfo also saves cleared cache to the file.

func (*Cache) Save

func (c *Cache) Save() error

Save writes the receiver to the cache file. It returns an *os.PathError if it can't create a new cache file. Also it returns an error if it failed to encode *Cache with TOML format.

func (*Cache) SetCommandHistory added in v0.7.3

func (c *Cache) SetCommandHistory(h []string) *Cache

func (*Cache) SetInstalledBy added in v0.7.3

func (c *Cache) SetInstalledBy(mt MeansType) *Cache

SetInstalledBy sets means how Evans was installed.

func (*Cache) SetUpdateInfo added in v0.7.3

func (c *Cache) SetUpdateInfo(latest *version.Version) *Cache

SetUpdateInfo sets an updatable flag to true and the latest version info to passed version.

type MeansType

type MeansType updater.MeansType
const MeansTypeUndefined MeansType = ""

type UpdateInfo added in v0.7.3

type UpdateInfo struct {
	UpdateAvailable bool   `default:"false" toml:"updateAvailable"`
	LatestVersion   string `default:"" toml:"latestVersion"`
}

Jump to

Keyboard shortcuts

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