~/bend-docscommunity

fs.bend checks

raw source on the hub · import cswap-bend-cli@0.1.0.0/fs.bend as Fs

1 import
import Base

Definitions

def Res source · line 8 · raw

@-A:Type -> Type

def proc.timeout source · line 11 · raw

U32

def proc.max source · line 14 · raw

U32

def tool.status source · line 17 · raw

@ok:Bool -> @status:U32 -> @out:String -> @err:String -> Res(String)

def tool.out source · line 25 · raw

@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> Res(String)

Run a tool; Done{stdout} on exit status 0, else Fail{(status, stderr)}.

def tool.unit source · line 32 · raw

@r:Res(String) -> Res(Unit)

def tool source · line 39 · raw

@program:String -> @args:List<&1, String> -> IO(Res(String))

def tool_unit source · line 44 · raw

@program:String -> @args:List<&1, String> -> IO(Res(Unit))

def then source · line 48 · raw

@r:Res(Unit) -> @next:IO(Res(Unit)) -> IO(Res(Unit))

Run next only when the previous step worked.

def read.done source · line 57 · raw

@fr:Pair(File, Res(String)) -> IO(Res(String))

def read.sized2 source · line 61 · raw

@f:File -> @r:Res(U32) -> IO(Res(String))

def read.sized source · line 68 · raw

@fr:Pair(File, Res(U32)) -> IO(Res(String))

def read.open source · line 72 · raw

@r:Res(File) -> IO(Res(String))

def read_file source · line 80 · raw

@path:String -> IO(Res(String))

The whole file as text. Fail{(errno, message)} when it cannot be read.

def exists.of source · line 85 · raw

@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> Bool

def exists source · line 93 · raw

@path:String -> IO(Bool)

Does the path exist (a file, directory or the target of a symlink)?

def names.keep source · line 98 · raw

@empty:Bool -> @h:String -> @rest:List<&2, String> -> List<&2, String>

def names source · line 105 · raw

@ls:List<&2, String> -> List<&2, String>

def list.of source · line 112 · raw

@r:Res(String) -> Res(List<&2, String>)

def list_dir source · line 121 · raw

@path:String -> IO(Res(List<&2, String>))

Entry names of a directory (hidden ones included, . and .. not), in ls order. A name holding a newline is not representable.

def sel.s source · line 127 · raw

@c:Bool -> @x:String -> @y:String -> String

def slash.pick source · line 134 · raw

@hit:Bool -> @t:String -> @rest:String -> String

def slash.drop source · line 142 · raw

@s:String -> String

Drop through the first / (the input is a reversed path).

def dirname.fin source · line 149 · raw

@s:String -> @absolute:Bool -> String

def dirname source · line 157 · raw

@+p:String -> String

Everything before the last /: "a/b/c" is "a/b", "/x" is "/", "x" is ".".

def read.stdin source · line 163 · raw

@r:Res(File) -> IO(Res(String))

def read_stdin source · line 172 · raw

IO(Res(String))

What is on standard input, up to 1 MiB, in one read: "" at end of file. The CLI reads stdin once (a token, a confirmation), so one read is enough.