installs

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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 IsDev

func IsDev(v string) bool

IsDev reports a development build's version (not a release anyone can download).

func ManagerOf

func ManagerOf(p string) string

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

func Newer(a, b string) bool

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

func Program(l List, steps []Step) string

Program is the hopsesh the machine runs once the steps are done: its own one, or the copy they install.

func Script

func Script(goos string) string

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 Tilde

func Tilde(p, home string) string

Tilde shortens a path in home to ~/….

func UpdateCommand

func UpdateCommand(manager, v, arch string) string

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.

func (Install) Runs

func (i Install) Runs(p string) bool

Runs reports whether p is this install's program or one of its links.

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

func Parse(out []byte, goos, arch, home string) List

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.

func (List) Main

func (l List) Main() *Install

Main is the machine's own hopsesh, or nil when there is none.

func (List) Mixed

func (l List) Mixed() bool

Mixed reports whether the installs there are not all one version.

func (List) Versions

func (l List) Versions() []string

Versions are the distinct versions installed, oldest first ("" left out).

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

func Plan(l List, to, ownPath string) []Step

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).

Jump to

Keyboard shortcuts

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