lib

package
v0.0.0-...-c2b7908 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

The lib package is the implementation of the core functionality of the raid CLI tool.

Index

Constants

View Source
const (
	ConfigDirName       = ".raid"
	ConfigFileName      = "config.toml"
	ConfigPathDefault   = "~" + sys.Sep + ConfigDirName + sys.Sep + ConfigFileName
	ConfigPathFlag      = "config"
	ConfigPathFlagShort = "c"
	ConfigPathFlagDesc  = "configuration file path (default is " + ConfigPathDefault + ")"
)
View Source
const (
	ACTIVE_PROFILE_KEY  = "profile"
	ALL_PROFILES_KEY    = "profiles"
	PROFILE_SCHEMA_PATH = "schemas/raid-profile.schema.json"
)
View Source
const (
	ACTIVE_ENV_KEY = "env"
)
View Source
const (
	YAML_SEP = "---"
)

Variables

View Source
var CfgPath string

Functions

func AddProfile

func AddProfile(profile Profile)

func AddProfiles

func AddProfiles(profiles []Profile)

func CloneRepository

func CloneRepository(repo Repo) error

func ContainsEnv

func ContainsEnv(name string) bool

func ContainsProfile

func ContainsProfile(name string) bool

func ExecuteEnv

func ExecuteEnv(name string) error

func ForceLoad

func ForceLoad() error

func GetEnv

func GetEnv() string

func InitConfig

func InitConfig() error

func Install

func Install(maxThreads int) error

func ListEnvs

func ListEnvs() []string

func Load

func Load() error

func RemoveProfile

func RemoveProfile(name string) error

func Set

func Set(key string, value any)

func SetEnv

func SetEnv(name string) error

func SetProfile

func SetProfile(name string) error

func ValidateProfile

func ValidateProfile(path string) error

func Write

func Write()

Types

type Context

type Context struct {
	Profile Profile
	Env     string
}

type Env

type Env struct {
	Name      string   `json:"name"`
	Variables []EnvVar `json:"variables"`
}

func (Env) IsZero

func (e Env) IsZero() bool

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Profile

type Profile struct {
	Name         string `json:"name"`
	Path         string `json:"path"`
	Repositories []Repo `json:"repositories"`
	Environments []Env  `json:"environments"`
}

func ExtractProfile

func ExtractProfile(name, path string) (Profile, error)

func ExtractProfiles

func ExtractProfiles(path string) ([]Profile, error)

func GetProfile

func GetProfile() Profile

func ListProfiles

func ListProfiles() []Profile

func (Profile) IsZero

func (p Profile) IsZero() bool

type Repo

type Repo struct {
	Name         string `json:"name"`
	Path         string `json:"path"`
	URL          string `json:"url"`
	Environments []Env  `json:"environments"`
}

func (Repo) IsZero

func (r Repo) IsZero() bool

Jump to

Keyboard shortcuts

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