whiteprints.cli.exception#

Command-Line Interface user defined exceptions.

Exceptions#

InvalidAppNameError

The application name is invalid.

Functions#

is_valid_slug(→ bool)

Check if a slug is valid.

check_app_name(→ str)

Check whether an app name is a valid slug.

Module Contents#

exception whiteprints.cli.exception.InvalidAppNameError(app_name: str)[source]#

Bases: ValueError

The application name is invalid.

Parameters:

app_name (str)

whiteprints.cli.exception.is_valid_slug(slug: str) bool[source]#

Check if a slug is valid.

Parameters:

slug (str) – The slug candidate name.

Return type:

bool

Example

>>> is_valid_slug("whiteprints")
True
>>> is_valid_slug("-bad slug")
False
Returns:

True if the slug name is valid, False otherwise.

Parameters:

slug (str)

Return type:

bool

whiteprints.cli.exception.check_app_name(app_name: str) str[source]#

Check whether an app name is a valid slug.

This function is the identity if the app name is a valid slug.

Parameters:

app_name (str) – The app name.

Return type:

str

Example

>>> check_app_name("valid-app-name")
'valid-app-name'
Raises:

InvalidAppNameError – The app name is not a valid slug.

Returns:

The app name.

Parameters:

app_name (str)

Return type:

str