Documentation ¶
Index ¶
- Variables
- func EnvDirFromProxyLink(executable string) (string, error)
- func FindEnvDir(binary string) (envDir string, err 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) 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.Reference, 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) 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) TriggerForPackage(l *ui.UI, event manifest.Event, pkg *manifest.Package) (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) Update(l *ui.UI, force bool) error
- func (e *Env) UpdateUsage(pkg *manifest.Package) error
- func (e *Env) Upgrade(l *ui.UI, pkg *manifest.Package) (*shell.Changes, *manifest.Package, error)
- func (e *Env) ValidateManifest(l *ui.UI, name string, options *ValidationOptions) ([]string, error)
- func (e *Env) ValidateManifests(l *ui.UI) (manifest.ManifestErrors, error)
- func (e *Env) Verify() error
- type InstalledPackagePredictor
- type PackagePredictor
- type ValidationOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ScriptSHAs contains the default known valid SHA256 sums for bin/activate-hermit and bin/hermit. ScriptSHAs = tidySha256Db(sha256Db) // InstallerTemplateSource is a string containing the installer template //go:embed "files/install.sh.tmpl" InstallerTemplateSource string // 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 := system.UserCacheDir() if err != nil { panic(fmt.Sprintf("could not find user cache dir: %s", err)) } return filepath.Join(cache, "hermit") }() )
Reset environment variables.
Functions ¶
func EnvDirFromProxyLink ¶
EnvDirFromProxyLink finds a Hermit environment given a proxy symlink.
func FindEnvDir ¶ added in v0.26.0
FindEnvDir finds the highest priority active Hermit environment
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."` InheritParent bool `` /* 152-byte string literal not displayed */ AddIJPlugin bool `hcl:"idea,optional" default:"false" help:"Whether Hermit should automatically add the IntelliJ IDEA plugin."` }
Config for a Hermit environment.
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is a Hermit environment.
func OpenEnv ¶
func OpenEnv( envDir string, state *state.State, packageSource cache.PackageSourceSelector, ephemeral envars.Envars, httpClient *http.Client, scriptSums []string, ) (*Env, error)
OpenEnv opens a Hermit environment.
The environment may not exist, in which case this will succeed but subsequent operations will fail.
"scriptSums" contains all known SHA256 checksums for "bin/hermit" and "bin/activate-hermit" scripts.
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.
This function is much faster than ListInstalled, if all you need is the Reference.
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.Reference, 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) TriggerForPackage ¶ added in v0.2.27
func (e *Env) TriggerForPackage(l *ui.UI, event manifest.Event, pkg *manifest.Package) (messages []string, err error)
TriggerForPackage triggers an event for a single package.
func (*Env) Update ¶ added in v0.16.0
Update sources and auto-update channels.
Will be updated at most every SyncFrequency unless "force" is true.
A Sources set can only be synchronised once. Following calls will not have any effect.
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) ValidateManifest ¶ added in v0.2.21
ValidateManifest with given name.
Returns the resolution errors for core systems as warnings. If a version fails to resolve for all systems, returns an error.
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
type ValidationOptions ¶ added in v0.2.25
type ValidationOptions struct { // CheckSources if true, check that the package sources are reachable CheckSources bool }
ValidationOptions for manifest validation
Directories ¶
Path | Synopsis |
---|---|
Package archive extracts archives with a progress bar.
|
Package archive extracts archives with a progress bar. |
cmd
|
|
gendocs
nolint
|
nolint |
Package github implements a client for GitHub that includes the minimum set of functions required by Hermit.
|
Package github implements a client for GitHub that includes the minimum set of functions required by Hermit. |
internal
|
|
Package ui provides the terminal UI formatter for Hermit.
|
Package ui provides the terminal UI formatter for Hermit. |