Documentation
¶
Overview ¶
Package installs finds every hopsesh on a machine: the app, a command you installed, one a package manager owns, and the copy hopsesh puts in ~/.hopsesh/bin when it sets a machine up. It says who owns each, which one is the machine's own (Main: the one its login service, other machines and its hooks should run), and plans an update that leaves every copy hopsesh may replace at one version, so the app, the command in your terminal and the service that receives sessions never drift apart.
The facts are read by a script (Script) run on the machine, locally or over SSH, so any version of hopsesh there, or none, can be listed; Parse and Plan are plain functions.
Index ¶
Constants ¶
const ( DoInstall = "install" // put this hopsesh in ~/.hopsesh/bin (nothing else is there) DoReplace = "replace" // write this hopsesh over an older copy hopsesh may replace DoApp = "app" // update the app with its own verified updater DoLink = "link" // point hopsesh's own copy at the machine's own hopsesh DoManual = "manual" // a package manager owns it: the user updates it DoKeep = "keep" // left as it is, with why (a development build can't update an app) DoService = "service" // start the machine's own hopsesh at login instead of another )
What a Step does.
Variables ¶
This section is empty.
Functions ¶
func ManagerOf ¶
ManagerOf names the package manager that owns the program at p by where it is (Homebrew, Scoop, winget), or "" (a Linux package is found by asking dpkg, rpm or apk).
func Newer ¶
Newer reports whether hopsesh version a is newer than b. Development builds are never newer (nobody can update to one) and anything is newer than an unknown version.
func Program ¶
Program is the hopsesh the machine runs once the steps are done: its own one, or the copy they install.
func Script ¶
Script is what lists hopsesh on a machine running goos: sh on macOS and Linux (pass where the user's shell finds hopsesh as its first argument, or ""), PowerShell on Windows. It prints tab-separated lines that Parse reads:
at <path> <program> a path that runs <program> (links followed) ver <program> <line> what <program> version says pkg <program> <manager> a Linux package owns <program> (apt, dnf, apk) appdir <program> <dir> <program> is in the Windows app's folder <dir> term <program> the user's shell runs <program> svc <program> <0|1> the login service runs <program>; 1: it is there open <bundle> the app at <bundle> is running
func UpdateCommand ¶
UpdateCommand is how the user updates hopsesh from a package manager to version v.
Types ¶
type Install ¶
type Install struct {
Path string `json:"path"` // the program, links followed
Links []string `json:"links,omitempty"` // other paths that run it (~/.local/bin/hopsesh → the app's)
Version string `json:"version,omitempty"`
Kind Kind `json:"kind"`
// Bundle is the app (hopsesh.app, or the Windows app's folder); Open: it is running.
Bundle string `json:"bundle,omitempty"`
Open bool `json:"open,omitempty"`
// Manager owns a Package; UpdateWith is the command that updates it there.
Manager string `json:"manager,omitempty"`
UpdateWith string `json:"updateWith,omitempty"`
Main bool `json:"main,omitempty"`
Terminal bool `json:"terminal,omitempty"` // the user's shell runs this one
Service bool `json:"service,omitempty"` // hopsesh's login service runs this one
}
Install is one hopsesh program on a machine.
type Kind ¶
type Kind string
Kind is what an install is.
const ( App Kind = "app" // hopsesh.app, or the Windows app's folder (with the command inside) Command Kind = "command" // a hopsesh you installed: install.sh, a release archive, go install Own Kind = "own" // the copy hopsesh puts in ~/.hopsesh/bin when it sets a machine up Package Kind = "package" // owned by a package manager (Homebrew, Scoop, winget, apt, dnf, apk) )
type List ¶
type List struct {
OS string `json:"os"`
Arch string `json:"arch,omitempty"`
Home string `json:"home,omitempty"`
Installs []Install `json:"installs"`
// Service is the program hopsesh's login service runs ("" when there is none);
// ServiceGone: that program is not there any more (the app was deleted or moved).
Service string `json:"service,omitempty"`
ServiceGone bool `json:"serviceGone,omitempty"`
// Terminal is where the user's shell finds hopsesh ("" when it does not).
Terminal string `json:"terminal,omitempty"`
}
List is every hopsesh on one machine.
func Parse ¶
Parse reads what Script printed on a machine running goos (arch and home as the machine reports them) into its list of installs, with the machine's own one chosen.
type Step ¶
type Step struct {
Do string `json:"do"`
Path string `json:"path"`
Bundle string `json:"bundle,omitempty"` // DoApp: the app (Path is its hopsesh)
From string `json:"from,omitempty"` // its version now
To string `json:"to,omitempty"` // the version it gets
Text string `json:"text"`
Command string `json:"command,omitempty"` // DoManual: what the user runs there
}
Step is one thing an update does on a machine.
func Plan ¶
Plan is what updating hopsesh on a machine (l) to version to does: every copy hopsesh may replace that is older is brought to it (the app by its own updater, the others with this program), hopsesh's own copy runs the machine's own hopsesh when there is another (so the hooks that name it keep working), a package is left to its manager, and the login service runs the machine's own hopsesh. Nothing newer than to is touched. ownPath is where hopsesh's own copy goes, and links are possible there (not Windows).