config

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestFilename = "manifest.json"

ManifestFilename contains the filename of the manifest file

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file

func DeleteFileOrDirectory

func DeleteFileOrDirectory(path, filename string) error

DeleteFileOrDirectory delets a file or directory

func FileExists

func FileExists(path, filename string) bool

FileExists checks if a file exists in a particular path

func Init

func Init(path string) error

Init initializes a new manifest

func MakeDir

func MakeDir(homeDir string, subDirs ...string) error

func ManifestExists

func ManifestExists(path string) bool

ManifestExists returns true if the manifest already exists

func NodeFile

func NodeFile(homeDir, nodeID string) string

func NodesDir

func NodesDir(homeDir string) string

func PathExists

func PathExists(path string) bool

PathExists checks if a path exists

func PluginsDir

func PluginsDir(homeDir string) string

func Read

func Read(path, filename string) ([]byte, error)

Read returns the contents of a file in a particular path

func ReadDirs

func ReadDirs(path string) ([]os.FileInfo, error)

func ReadFile

func ReadFile(path, filename string, v interface{}) error

ReadFile returns the unmarshalled contents of a json file in a particular path

func Walk

func Walk(path string, f filepath.WalkFunc) error

Walk is a wrapper around filepath.Walk

This can probably get refactored because it literally does nothing other than call filepath.Walk

func WriteFile

func WriteFile(path, filename string, v interface{}) error

WriteFile writes the json-marshalled content of an interface into a file in a particular path

Types

type Manifest

type Manifest struct {
	// Plugins are a map of package name -> version
	Plugins                   map[string]plugin.MetaInfo `json:"plugins"`
	LatestCLIVersion          string                     `json:"latest_cli_version"`
	LatestCLIVersionUpdatedAt time.Time                  `json:"latest_cli_version_updated_at"`

	// this could be internal (lower case) but golanglint-ci will complain
	Path string `json:"-"`
}

Manifest contains information about the installed plugins and cli

func LoadManifest

func LoadManifest(path string) (Manifest, error)

LoadManifest reads the manifest from a file

func (*Manifest) HasPluginsInstalled

func (m *Manifest) HasPluginsInstalled() bool

HasPluginsInstalled returns true if there is at least one installed plugin

func (*Manifest) RemovePlugin

func (m *Manifest) RemovePlugin(pluginName string) error

RemovePlugin removes a plugin from the manifest

To write the changes to disk use `Write`

func (*Manifest) UpdatePlugin

func (m *Manifest) UpdatePlugin(pluginName string, pluginInfo plugin.MetaInfo) error

UpdatePlugin updates information about one particular plugin

To write the changes to disk use `Write`

func (*Manifest) Write

func (m *Manifest) Write() error

Write writes the manifest to disk

Jump to

Keyboard shortcuts

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