def whole.listed

ezx@1.11.0.0 · src/lock/run.bend:476

import ezx@1.11.0.0/src/lock/run.bend as Run
import Base
import snap@1.4.0.0/main.bend as R
import ezx@1.11.0.0/src/pkg/pkg.bend as K
import ezx@1.11.0.0/src/lock/up.bend as Up

476# the checkout, its `.git` removed, weighed, and every file of it read; then
477# removed. Nothing is laid: `ez add` lays the tree from its plan.
478# the files of a checkout, read, once `find` has listed them. A listing that
479# failed is refused rather than read: `find` writes what it could not reach
480# to stderr, which snap answers beside the paths (SNAP-ANS-4), and such a
481# line is no path of the package.
482def whole.listed(ok: Bool, +work: String, +nar: String, +text: String) -> IO(Up.Answer):
483  match ok:
484    case True{}:
485      do IO<Up.Answer>:
486        fs : List<&2, K.Source> <- whole.read(work, nonempty(String.lines(text)))
487        _rm : String <- R.exec(["rm", "-rf", work])
488        return Up.Cloned{nar, fs}
489    case False{}:
490      do IO<Up.Answer>:
491        _rm : String <- R.exec(["rm", "-rf", work])
492        return Up.Miss{"ez: could not list the checkout: " ++ String.trim(text)}

Uses (14)

Used by (1)