Change your command's environment variables (with_env)

Environment variables can be set and passed down to commands or, alternative, environment variables can be explicitly dropped.

All parent environment variables will be passed on by default.

from commandlib import Command

With extra environment variable:

Command("./outputtext").with_env(ENVVAR="tom").run()

Will output:

hello tom

Dropping an environment variable:

Command("./outputpath").without_env("HOME").run()

Will output:

hello

Dropping nonexistent variable does nothing:

Command("outputtext").without_env("NONEXISTENTVAR").with_path(".").run()

Will output:

hello

Executable specification

Documentation automatically generated from environment-variables.story storytests.