Skip to content

Exit

Bases: Exception

Raise to early quit a Platitude CLI program without erroring out.

There are occasions in which one might want to quit middway the execution in a clean way. This is accomplished by raising the platitudes.Exit exception. This will be automatically catched by an internal try/except block and exit with code 0 (success).

Example
import platitudes as pl

def early_exit(processing_level: str):
    match processing_level:
        case "simple":
            print("I can do simple!")
        case _:
            print("Too much for me")
            raise pl.Exit()

pl.run(early_exit)