Module

pooka/env

src/pooka/env.pooka

The process arrives with a little weather from its surroundings.

Read arguments, environment variables and platform information through Erlang. Missing variables use Option, while operating-system failures use EnvError. Arguments exclude the Pooka executable entrypoint.

Pooka
import pooka/env

let assert Ok(value) = env.get("POOKA_EXAMPLE")

API reference

class

EnvError

src/pooka/env.pooka:19
class EnvError(message: String)

A env failure carrying the details needed by its caller. Keep this value in Result until a boundary can explain it.

field

message

src/pooka/env.pooka:19
message: String
INFERREDString
constructor

new

src/pooka/env.pooka:19
INFERREDfn(String) -> pooka/env.EnvError
function

args

src/pooka/env.pooka:55
args() -> List(String)
INFERREDfn() -> List(String)

Return program arguments without the executable entrypoint path.

Pooka
import pooka/env

let arguments = env.args()
function

get

src/pooka/env.pooka:66
get(name: String) -> Result(Option(String), EnvError)
INFERREDfn(String) -> Result(Option(String), pooka/env.EnvError)

Read a variable. An absent name returns Ok(None).

Pooka
import pooka/env

let assert Ok(value) = env.get("POOKA_EXAMPLE")
function

set

src/pooka/env.pooka:77
set(name: String, value: String) -> Result(Nil, EnvError)
INFERREDfn(String, String) -> Result(Nil, pooka/env.EnvError)

Set a variable in this process environment.

Pooka
import pooka/env

let result = env.set("POOKA_EXAMPLE", "oak")
function

unset

src/pooka/env.pooka:88
unset(name: String) -> Result(Nil, EnvError)
INFERREDfn(String) -> Result(Nil, pooka/env.EnvError)

Remove a variable from this process environment.

Pooka
import pooka/env

let result = env.unset("POOKA_EXAMPLE")
function

current_directory

src/pooka/env.pooka:100
current_directory() -> Result(String, EnvError)
INFERREDfn() -> Result(String, pooka/env.EnvError)

Read the current working directory, retaining operating-system failure as EnvError.

Pooka
import pooka/env

let result = env.current_directory()
function

home_directory

src/pooka/env.pooka:111
home_directory() -> Result(Option(String), EnvError)
INFERREDfn() -> Result(Option(String), pooka/env.EnvError)

Read the home directory when available.

Pooka
import pooka/env

let result = env.home_directory()
function

os

src/pooka/env.pooka:122
os() -> String
INFERREDfn() -> String

Return the Erlang runtime's operating-system name.

Pooka
import pooka/env

let system = env.os()
function

architecture

src/pooka/env.pooka:133
architecture() -> String
INFERREDfn() -> String

Return the runtime system architecture string.

Pooka
import pooka/env

let architecture = env.architecture()