~/bend-docscommunity

src/args.bend checks

raw source on the hub · import shake@0.5.0.0/src/args.bend as Args

shake/args: the process's arguments, each word reusable, and the values of a spec's env vars, internal (main.bend exports them). IO.args answers a &1 list that starts with the program as invoked (bend 2.0.32 and later); the rest of a program reads the line more than once, so words drops that head and copies the rest.

2 imports
import Base
import ./cli.bend as C

Definitions

def copy source · line 10 · raw

@xs:List<&1, String> -> List<&2, String>

a &1 list copied to &2

def words source · line 18 · raw

@xs:List<&1, String> -> List<&2, String>

the arguments of an IO.args line: every word after the program name, copied

def argv source · line 26 · raw

IO(List<&2, String>)

the process's arguments, without the program name

def kept source · line 31 · raw

@+name:String -> @got:Result<&1, &1, Pair(U32, String), String> -> @rest:List<&2, 0x1b64bb5828eb2210a4a61a1ba480631a/src/cli.Var> -> List<&2, 0x1b64bb5828eb2210a4a61a1ba480631a/src/cli.Var>

a name and its value in front of the pairs, when IO.get_env found one

def vars source · line 43 · raw

@names:List<&2, String> -> IO(List<&2, 0x1b64bb5828eb2210a4a61a1ba480631a/src/cli.Var>)

the names that are set, each with its value, in order

def env_vars source · line 53 · raw

@spec:0x1b64bb5828eb2210a4a61a1ba480631a/src/cli.Cli -> IO(List<&2, 0x1b64bb5828eb2210a4a61a1ba480631a/src/cli.Var>)

the env vars a spec names that are set, each with its value