profile

package
v0.0.0-...-e081c89 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package profile is used to read the various non-default murex user profiles and modules

Index

Constants

View Source
const (
	// DisabledFile is an array of disabled modules
	DisabledFile = "disabled.json"

	// PackagesFile is used by the package manager, `murex-package`, but we auto-create
	// it here for consistency
	PackagesFile = "packages.json"

	// IgnoredExt is an file extension which can be used on package directories
	// to have them ignored during start up
	IgnoredExt = ".ignore"
)
View Source
const (

	// PreloadEnvVar environmental variable name for the preload profile override path. It's stored as a constant so typos are caught by the compiler
	PreloadEnvVar = "MUREX_PRELOAD"

	// ModuleEnvVar environmental variable name for the module override path. It's stored as a constant so typos are caught by the compiler
	ModuleEnvVar = "MUREX_MODULES"

	// ProfileEnvVar environmental variable name for the profile override path. It's stored as a constant so typos are caught by the compiler
	ProfileEnvVar = "MUREX_PROFILE"
)
View Source
const (
	F_PRELOAD = 1 << iota
	F_MODULES
	F_PROFILE
)

Variables

View Source
var (
	// Packages is a struct of all the modules
	Packages = make(map[string][]Module)
)

Functions

func Execute

func Execute(flags int)

Execute runs the preload script, then murex modules followed by your murex profile

func ModulePath

func ModulePath() string

ModulePath returns the install path of the murex modules / packages

func PreloadPath

func PreloadPath() string

PreloadPath returns the path of the preload profile

func ProfilePath

func ProfilePath() string

ProfilePath returns the path of your murex profile

func ReadJson

func ReadJson(path string, v interface{}) error

ReadJson is a function for reading a JSON file from disk

Types

type Dependencies

type Dependencies struct {
	Optional     []string
	Required     []string
	Platform     []string
	MurexVersion string
}

Dependencies is a list of executables required by the module plus a list of OSs the module is expected to work against

type Module

type Module struct {
	Name         string
	Summary      string
	Version      string
	Source       string
	Package      string
	Disabled     bool
	Loaded       bool
	Dependencies Dependencies
}

Module is the structure for each module within a module's directory. Each directory can have multiple modules - this is done so you can separate functionality into different logical modules but still keep them inside one git repository (or other source control). However I expect the typical usage would be one module per repository.

This structure is loaded from module.json file located inside the root of the package.

func LoadPackage

func LoadPackage(path string, execute bool) ([]Module, error)

LoadPackage reads in the contents of the package and then validates and sources each module within. The path value should be an absolute path.

func (*Module) Path

func (m *Module) Path() string

Path returns the full path to the murex script that is sourced into your running shell

type Package

type Package struct {
	Name         string
	Version      string
	Dependencies Dependencies
}

Package is some basic details about the package itself as seen in the package.json file located at the rood directory inside the package itself

Jump to

Keyboard shortcuts

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