lockjson

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockJSON

type LockJSON struct {
	Version            int64       `json:"version"`
	CurrentProfileName string      `json:"current_profile_name"`
	Repos              ReposList   `json:"repos"`
	Profiles           ProfileList `json:"profiles"`
}

LockJSON is marshallable content of lock.json

func Read

func Read() (*LockJSON, error)

Read reads from lock.json and returns LockJSON

func ReadNoMigrationMsg added in v0.1.2

func ReadNoMigrationMsg() (*LockJSON, error)

ReadNoMigrationMsg is same as Read, but no migration message is printed.

func (*LockJSON) GetCurrentReposList added in v0.3.3

func (lockJSON *LockJSON) GetCurrentReposList() (ReposList, error)

GetCurrentReposList returns current profile's repositories.

func (*LockJSON) GetReposListByProfile

func (lockJSON *LockJSON) GetReposListByProfile(profile *Profile) (ReposList, error)

GetReposListByProfile collects each repository of given profile and returns it.

func (*LockJSON) Write

func (lockJSON *LockJSON) Write() error

type Profile

type Profile struct {
	Name      string        `json:"name"`
	ReposPath profReposPath `json:"repos_path"`
}

Profile is a element of LockJSON.Profiles

type ProfileList

type ProfileList []Profile

ProfileList = []Profile

func (ProfileList) FindByName

func (plist ProfileList) FindByName(name string) (*Profile, error)

FindByName finds name from all profiles and returns it. Non-nil pointer is returned if found. nil pointer is returned if not found.

func (ProfileList) FindIndexByName

func (plist ProfileList) FindIndexByName(name string) int

FindIndexByName same as FindByName but returns index. idx >= 0 is returned if found. idx == -1 is returned if not found.

func (ProfileList) RemoveAllReposPath

func (plist ProfileList) RemoveAllReposPath(reposPath pathutil.ReposPath) error

RemoveAllReposPath removes all reposPath from all profiles' repos path list.

type Repos

type Repos struct {
	Type    ReposType          `json:"type"`
	Path    pathutil.ReposPath `json:"path"`
	Version string             `json:"version"`
}

Repos is a element of LockJSON.Repos

type ReposList

type ReposList []Repos

ReposList = []Repos

func (ReposList) Contains

func (reposList ReposList) Contains(reposPath pathutil.ReposPath) bool

Contains returns true if reposList contains reposPath.

func (ReposList) FindByPath

func (reposList ReposList) FindByPath(reposPath pathutil.ReposPath) *Repos

FindByPath finds reposPath from reposList. Non-nil pointer is returned if found. nil pointer is returned if not found.

func (*ReposList) RemoveAllReposPath added in v0.3.3

func (reposList *ReposList) RemoveAllReposPath(reposPath pathutil.ReposPath) error

RemoveAllReposPath removes all reposPath from all repos path list.

type ReposType

type ReposType string

ReposType = string

const (
	// ReposGitType = "git"
	ReposGitType ReposType = "git"
	// ReposStaticType = "static"
	ReposStaticType ReposType = "static"
	// ReposSystemType = "system"
	ReposSystemType ReposType = "system"
)

Jump to

Keyboard shortcuts

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