🖼️ diagrams.sh
This script generates UML diagrams for a specified Python module using pyreverse. It checks for dependencies, loads environment variables, sets directories, and processes command-line arguments for customization of module names, directories, and output locations.
Overview
The script performs the following operations:
-
Dependency Checks: Verifies the presence of required tools:
graphvizfor.dotfile handling.pythonfor running Python-based commands.pylint(withpyreverse) for generating UML diagrams.
-
Environment Variable Setup: Sets default values for module name, module directory, and output directory (
MODULE_NAME,MODULE_DIR,OUTPUT_DIR). These can be customized via environment variables or command-line arguments. -
Argument Parsing: Parses optional arguments to allow customization:
-mor--module-nameto specify the module name.-dor--module-dirto specify the module directory.-oor--output-dirto specify the output directory.
-
Directory Creation: Creates subdirectories within the output directory for organizing different types of UML and flowchart outputs:
classesfor class diagrams.packagesfor package diagrams.
-
Diagram Generation: Runs
pyreverseto create UML diagrams in multiple formats (html,pdf,png, andsvg) and organizes them into respective directories. -
Completion Message: Displays a message confirming successful generation of diagrams.
Usage
To run the script: