Reference

chenv.cli

Command-line interface.

chenv.console

user inteaction utilities.

class chenv.console.Color(value)

Colors for output.

docs: https://click.palletsprojects.com/en/7.x/api/#click.style

Formart symlink relation, standardized, in color.

Return type

str

chenv.console.contextify(context, context_fg, message)

Add context prefix to messages.

Return type

str

chenv.console.error(context, message)

Echo error colored messages with context.

Return type

None

chenv.console.fatal(context, message, exit_code)

Exit the program after echoing an error colored messages with context.

Return type

NoReturn

chenv.console.get_env_or_prompt(context, key)

Get or prompt user for chenv-specific environment variable.

Return type

str

chenv.console.info(context, message)

Echo info colored messages with context.

Return type

None

chenv.console.pretty_failures(func)

Prettifies failures for wrapped function, unless in debug mode.

Return type

Callable

chenv.fs

filesystem utilities.

chenv.fs.assign_env(filename, variables, overwrite=True)

Dumps output as filename, then links .env to it.

Return type

None

chenv.fs.dump(filename, variables, overwrite)

Sets variables to the file at filename.

Return type

None

chenv.fs.filename_from_template(file_suffix)

Create full .env-style filename from file_suffix.

Return type

str

Symlinks source_path to .env, forcibly.

Return type

None

chenv.fs.load(*, path=None, file_suffix=None)

Load application variables from a .env file at path or file_suffix.

Return type

dict

chenv.fs.load_lines(file_path)

Creates a generator for lines in file_path.

Return type

Generator[str, None, None]

chenv.fs.local_file_path(filename)

Returns the full path of a local file.

Return type

str

chenv.settings

general settings for the application.

chenv.settings.add(key, value)

Adds a new env-variable to the application’s local .env file.

Return type

None

chenv.settings.debug_mode()

Returns whether chenv runs in debug mode.

Return type

bool

chenv.settings.mount()

Mount (load and set in current process) application variables from the local .env file.

Return type

None

chenv.transform

perform transformations on env-variables sets.

chenv.transform.apply(output)

Apply all transformations to the Output set.

Return type

Output

chenv.inputs

chenv.models

Model decalrations for the applications.

chenv.models.output

declares outputs used to generate .env-style files.

class chenv.models.output.Output(file_suffix, variables)

Bases: object

Declares a target file, and variables, to use as the .env file.

property filename

Generate a filename from this Target (by file_suffix).

Return type

str