maybe_update_state
Updates the global state object with application, function, and module or file path information extracted from the Click context parameters. It validates that the provided path exists or matches a valid Python module pattern, exiting the process with an error message if the input is invalid.
def maybe_update_state(
ctx: click.Context
) - > None
Updates the global state object with application, function, and source details extracted from the Click context. This function ensures that the provided source is either a valid existing file path or a syntactically correct Python module name before updating the state.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | click.Context | The Click context object containing parsed command-line parameters such as 'path_or_module', 'app', and 'func'. |
Returns
| Type | Description |
|---|---|
None | Nothing is returned; the function modifies the global state object directly. |