# std.env

Environment variable access and working directory management.

```tea
use env from "std.env"
```

Examples may be fragments requiring the module import or additional setup.

## std.env.get

```tea
pub def get(name: String) -> String
```

Get the value of an environment variable.

```tea
var path = env.get("PATH")
```

## std.env.get_or

```tea
pub def get_or(name: String, fallback: String) -> String
```

Get the value of an environment variable, or a fallback when it is unset.

## std.env.has

```tea
pub def has(name: String) -> Bool
```

Return true when an environment variable is set.

## std.env.require

```tea
pub def require(name: String) -> String
```

Get an environment variable or fail when it is unset.

## std.env.set

```tea
pub def set(name: String, value: String) -> Void
```

Set an environment variable.

```tea
env.set("MY_VAR", "my_value")
```

## std.env.unset

```tea
pub def unset(name: String) -> Void
```

Unset an environment variable.

## std.env.vars

```tea
pub def vars() -> Dict[String, String]
```

Get all environment variables as a dictionary.

```tea
var all_vars = env.vars()
```

## std.env.executable

```tea
pub def executable() -> String
```

Return the absolute path of the running executable, independent of the working directory.

## std.env.cwd

```tea
pub def cwd() -> String
```

Get the current working directory.

```tea
var cwd = env.cwd()
```

## std.env.set_cwd

```tea
pub def set_cwd(path: String) -> Void
```

Change the current working directory.

## std.env.temp_dir

```tea
pub def temp_dir() -> String
```

Return the platform temporary directory.

## std.env.home_dir

```tea
pub def home_dir() -> String
```

Return the user home directory when available.

## std.env.config_dir

```tea
pub def config_dir() -> String
```

Return the user configuration directory when available.
