Documentation ¶
Index ¶
- Variables
- func EnvDirFromProxyLink(executable string) (string, error)
- func Init(l *ui.UI, env string, distURL string, stateDir string, config Config) error
- type CleanMask
- type Config
- type Env
- func (e *Env) AddSource(l *ui.UI, s sources.Source) error
- func (e *Env) BinDir() string
- func (e *Env) Clean(l *ui.UI, level CleanMask) error
- func (e *Env) DelEnv(key string) error
- func (e *Env) EnsureChannelIsUpToDate(l *ui.UI, pkg *manifest.Package) error
- func (e *Env) EnvDir() string
- func (e *Env) EnvOps(l *ui.UI) (envars.Ops, error)
- func (e *Env) Envars(l *ui.UI, inherit bool) ([]string, error)
- func (e *Env) Exec(l *ui.UI, pkg *manifest.Package, binary string, args []string, ...) error
- func (e *Env) GC(l *ui.UI, age time.Duration) error
- func (e *Env) Install(l *ui.UI, pkg *manifest.Package) (*shell.Changes, error)
- func (e *Env) LinkedBinaries(pkg *manifest.Package) (binaries []string, err error)
- func (e *Env) ListInstalled(l *ui.UI) ([]*manifest.Package, error)
- func (e *Env) ListInstalledReferences() ([]manifest.Reference, error)
- func (e *Env) Resolve(l *ui.UI, selector manifest.Selector, syncOnMissing bool) (*manifest.Package, error)
- func (e *Env) ResolveLink(l *ui.UI, executable string) (pkg *manifest.Package, binary string, err error)
- func (e *Env) ResolveVirtual(l *ui.UI, name string) ([]*manifest.Package, error)
- func (e *Env) ResolveWithDeps(l *ui.UI, installed manifest.Packages, selector manifest.Selector, ...) (err error)
- func (e *Env) Root() string
- func (e *Env) Search(l *ui.UI, pattern string) (manifest.Packages, error)
- func (e *Env) SetEnv(key, value string) error
- func (e *Env) Sources(l *ui.UI) ([]string, error)
- func (e *Env) Sync(l *ui.UI, force bool) error
- func (e *Env) Test(l *ui.UI, pkg *manifest.Package) error
- func (e *Env) Trigger(l *ui.UI, event manifest.Event) (messages []string, err error)
- func (e *Env) Uninstall(l *ui.UI, pkg *manifest.Package) (*shell.Changes, error)
- func (e *Env) Unpack(l *ui.Task, p *manifest.Package) error
- func (e *Env) UpdateUsage(pkg *manifest.Package) error
- func (e *Env) Upgrade(l *ui.UI, pkg *manifest.Package) (*shell.Changes, error)
- func (e *Env) ValidateManifests(l *ui.UI) (manifest.ManifestErrors, error)
- type InstalledPackagePredictor
- type PackagePredictor
Constants ¶
This section is empty.
Variables ¶
var ( // UserStateDir should be passed to Open()/Init() in most cases. UserStateDir = func() string { explicit := os.Getenv("HERMIT_STATE_DIR") if explicit != "" { return explicit } cache, err := os.UserCacheDir() if err != nil { panic(err) } return filepath.Join(cache, "hermit") }() )
Reset environment variables.
Functions ¶
func EnvDirFromProxyLink ¶
EnvDirFromProxyLink finds a Hermit environment given a proxy symlink.
Types ¶
type CleanMask ¶
type CleanMask int
CleanMask is a bitmask specifying which parts of a hermit system to clean.
type Config ¶
type Config struct { Envars envars.Envars `hcl:"env,optional" help:"Extra environment variables."` Sources []string `hcl:"sources,optional" help:"Package manifest sources."` ManageGit bool `hcl:"manage-git,optional" default:"true" help:"Whether Hermit should automatically 'git add' new packages."` }
Config for a Hermit environment.
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is a Hermit environment.
func OpenEnv ¶
OpenEnv opens a Hermit environment.
The environment may not exist, in which case this will succeed but subsequent operations will fail.
func (*Env) EnsureChannelIsUpToDate ¶
EnsureChannelIsUpToDate updates the package if it has an update interval, the required time since the last update check has passed, and the etag in the source has changed from the last check.
This should only be called for packages that have already been installed
func (*Env) EnvOps ¶
EnvOps returns the envar mutation operations for this environment.
PATH, HERMIT_BIN and HERMIT_ENV will always be explicitly set, plus all environment variables defined in the packages installed in the environment, and finally any environment variables explicitly configured in the environment.
func (*Env) Envars ¶
Envars returns the fully expanded envars for this environment.
PATH, HERMIT_BIN and HERMIT_ENV will always be explicitly set, plus all environment variables defined in the packages installed in the environment, and finally any environment variables explicitly configured in the environment.
If "inherit" is true, variables from the shell environment will be inherited. Otherwise only variables defined in Hermit itself will be available.
func (*Env) Exec ¶
func (e *Env) Exec(l *ui.UI, pkg *manifest.Package, binary string, args []string, deps map[string]*manifest.Package) error
Exec the specified binary from the given package, replacing this process.
"args" should be os.Args (or equivalent), including the binary name. "deps" contains all packages that need to be in the system for the execution. The missing dependencies are downloaded and unpacked.
func (*Env) LinkedBinaries ¶
LinkedBinaries lists just the binaries installed in the environment.
func (*Env) ListInstalled ¶
ListInstalled packages from this environment.
func (*Env) ListInstalledReferences ¶
ListInstalledReferences from this environment.
func (*Env) Resolve ¶
func (e *Env) Resolve(l *ui.UI, selector manifest.Selector, syncOnMissing bool) (*manifest.Package, error)
Resolve package reference.
If "syncOnMissing" is true, sources will be synced if the selector cannot be initially resolved, then resolve attempted again.
func (*Env) ResolveLink ¶
func (e *Env) ResolveLink(l *ui.UI, executable string) (pkg *manifest.Package, binary string, err error)
ResolveLink returns the package for a hermit bin dir link.
Link chains are in the form
<binary> -> <pkg>-<version>.pkg -> hermit
func (*Env) ResolveVirtual ¶
ResolveVirtual references to concrete packages.
func (*Env) ResolveWithDeps ¶
func (e *Env) ResolveWithDeps(l *ui.UI, installed manifest.Packages, selector manifest.Selector, out map[string]*manifest.Package) (err error)
ResolveWithDeps collect packages and their dependencies based on the given manifest.Selector into a map
func (*Env) UpdateUsage ¶
UpdateUsage updates the package usage time stamps in the underlying database. if the package was not previously present, it is inserted to the DB.
func (*Env) ValidateManifests ¶
ValidateManifests from all sources.
type InstalledPackagePredictor ¶ added in v0.2.3
type InstalledPackagePredictor struct {
// contains filtered or unexported fields
}
InstalledPackagePredictor is a shell completion predictor for installed package names
func NewInstalledPackagePredictor ¶ added in v0.2.3
func NewInstalledPackagePredictor(e *Env, l *ui.UI) *InstalledPackagePredictor
NewInstalledPackagePredictor returns a new InstalledPackagePredictor
type PackagePredictor ¶ added in v0.2.3
type PackagePredictor struct {
// contains filtered or unexported fields
}
PackagePredictor is a shell completion predictor for all package names
func NewPackagePredictor ¶ added in v0.2.3
NewPackagePredictor returns a new PackagePredictor
Directories ¶
Path | Synopsis |
---|---|
Package archive extracts archives with a progress bar.
|
Package archive extracts archives with a progress bar. |
cmd
|
|
gendocs
nolint
|
nolint |
internal
|
|
Package ui provides the terminal UI formatter for Hermit.
|
Package ui provides the terminal UI formatter for Hermit. |
Package xpath is an XPath parser supporting the minimal subset of XPath used by Hermit.
|
Package xpath is an XPath parser supporting the minimal subset of XPath used by Hermit. |