Expand description
zx “goods”: small helpers for scripts (sleep, retry, spinner, …).
Constants§
- SPINNER_
FRAMES - Frames drawn by
spinner.
Functions§
- echo
- Print the arguments joined by spaces followed by a newline (zx
echo). - echo_
line - The line
echowould print (without the trailing newline). - exp_
backoff - Exponential backoff delays:
min(delay * 2^n, max)for n = 0, 1, 2, … - exp_
backoff_ default exp_backoffwith zx’s defaults (max = 60s,delay = 100ms).- glob
- Expand a glob pattern into sorted paths (zx
glob, subset:*,?,[...]and**). Unreadable entries are skipped. - glob_in
- Expand a glob pattern relative to
cwd, returning paths relative to it. - retry
- Call
funtil it succeeds, at mostcounttimes, without delays. - retry_
with_ backoff - Like
retry, taking the delay after each failure fromdelays(for exampleexp_backoff). An exhausted iterator means no delay. - retry_
with_ delay - Like
retry, sleepingdelaybetween attempts. - sleep
- Pause for
duration(zxsleep). - sleep_
for - Pause for a zx duration string such as
"100ms"or"1s". - spinner
- Run
futwhile showing a spinner titledtitleon stderr (zxspinner). Verbose logging is disabled for the duration offut. - spinner_
enabled - Whether
spinnerwould draw anything: stderr must be a terminal,CIunset and the current scope not quiet. - tempdir
- Create (like
mkdir -p) and return a directory in the system temp dir.prefixdefaults tozx-<random id>. - tempfile
- Create a temp file and return its path (zx
tempfile). - which
- Locate an executable on
PATH(zxwhich).