~/bend-docscommunity

src/share/say.bend checks

raw source on the hub · import 0x886223f5c47e4983fe57d887c034bc7f/src/share/say.bend as Say

share/say: the words a long step says, and a spinner for the wait.

A clone, a hub fetch or a native build can sit there for half a minute, and a step that prints nothing looks stopped. The line is printed before the work. On a terminal it is drawn again in place, with a mark that moves, until the step finishes; the mark is a child, because the work itself is one program waited on to the end and nothing can be printed while it runs. That child is started with its own session and its standard streams closed, so it opens the terminal by the path this process's own stderr or stdout already has. A pipe is not a terminal: the line is printed once and left, which is what a log wants.

The words and the scripts the mark runs are here; what starts and stops the mark is share/spin, which runs programs and so reaches foreign code a law may not import.

2 imports
import Base
import ../pkg/path.bend as P

Types

type Spin source · line 22 · raw

Data

a spinner that is running, or none. An empty pid means the line was already printed and nothing has to be stopped. msg is what the terminal is owed when the mark is cleared.

Definitions

def brief.go source · line 27 · raw

@short:Bool -> @+rev:String -> String

the first twelve characters of a commit, which is enough to tell one from the next. A shorter name is already short.

def brief source · line 35 · raw

@+rev:String -> String

a commit as a line shows it

def label.go source · line 40 · raw

@empty:Bool -> @+hash:String -> @+name:String -> String

a package's name when its entry has one, otherwise the hash. main is kept: it is the name the file has.

def label source · line 48 · raw

@+hash:String -> @+entry:String -> String

what a line calls a package

def dep.git source · line 53 · raw

@+name:String -> @+url:String -> String

dep sha256: git fetch (https://github.com/…)

def dep.hub source · line 57 · raw

@+name:String -> String

a package taken from the hub

def reused source · line 61 · raw

@+name:String -> String

a binary already built for this commit

def resolving source · line 65 · raw

String

the lock resolving every dependency

def resolving.at source · line 68 · raw

@+name:String -> String

def git.fetch source · line 71 · raw

@+url:String -> String

def building source · line 75 · raw

@+name:String -> String

a binary being built

def linking source · line 79 · raw

@+at:String -> String

a binary being linked into place

def installed source · line 83 · raw

@+name:String -> @+at:String -> String

a binary built and linked

def linked source · line 87 · raw

@+name:String -> @+at:String -> String

a binary linked, with nothing to build

def hashing source · line 91 · raw

@+rev:String -> String

a commit's tree being weighed for its NAR hash

def tty.at source · line 95 · raw

@+path:String -> Bool

a device path that is a terminal. A pipe and /dev/null are not.

def tty.out source · line 99 · raw

@on:Bool -> @+out:String -> String

def tty.pick.go source · line 107 · raw

@on:Bool -> @+err:String -> @+out:String -> String

stderr's terminal when it is one, otherwise stdout's, otherwise none

def tty.pick source · line 114 · raw

@+err:String -> @+out:String -> String

def hub.miss source · line 119 · raw

@+why:String -> Bool

the hub answered 404 for a manifest. A missing file is a different miss: its path is not /manifest.

def hub.explain.go source · line 123 · raw

@miss:Bool -> @+hash:String -> @+url:String -> @+why:String -> String

def hub.explain source · line 131 · raw

@+hash:String -> @+url:String -> @+why:String -> String

def drift.where source · line 135 · raw

@bare:Bool -> @+tag:String -> @+rev:String -> String

the commit the words name. A tag is what a person pinned; a bare rev is not.

def drift source · line 145 · raw

@+name:String -> @+tag:String -> @+rev:String -> @+old:String -> @+new:String -> String

the tagged commit's tree no longer hashes to the pin. Upgrade will not invent a new hash for that: the pin is what the ledger says, and a drift is the ledger and the tree disagreeing.

def stuck source · line 153 · raw

@+name:String -> String

a drift judged before the tree was weighed, so there are not two hashes to show

def has.tools source · line 159 · raw

@+text:String -> Bool

a [tools. section in the ledger text. The parser is not asked: a ledger that does not parse can still have named the command.

def hint source · line 164 · raw

@tools:Bool -> String

ez sync is not a command. A ledger that pins tools already has the one that builds them; a ledger that does not is pointed at lock and install.

def probe source · line 173 · raw

String

the parent's fd, by number. The child cannot look at its own: that one was replaced with a pipe before this ran. $1 is the number.

def frames source · line 179 · raw

String

a mark on the terminal while the parent is alive. $1 is the terminal, $2 the line. The mark walks ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏. An empty parent id exits rather than spinning on /proc.

def settle source · line 183 · raw

String

the mark wiped, and the line left in its place