def take
import cswap-bend-cli@0.1.0.0/frame.bend as Frameimport Base
42# The first message of `buf` (json: a line; block: up to a blank line) and the
43# rest, none while the message is incomplete.
44def take(block: Bool, +buf: String) -> Maybe<&2, Cut>:
45 match block:
46 case True{}:
47 cut.at(blank.find(buf, 0n, True{}), buf)
48 case False{}:
49 cut.at(nl.find(buf, 0n), buf)