graph LR
Delegator_API_Facade_["Delegator API (Facade)"]
Command_Runner["Command Runner"]
Command_Object["Command Object"]
Piping_Mechanism["Piping Mechanism"]
Chaining_Orchestrator["Chaining Orchestrator"]
Delegator_API_Facade_ -- "exposes" --> Command_Runner
Delegator_API_Facade_ -- "exposes" --> Chaining_Orchestrator
Command_Runner -- "instantiates" --> Command_Object
Command_Object -- "provides" --> Piping_Mechanism
Piping_Mechanism -- "invokes" --> Command_Object
Chaining_Orchestrator -- "uses" --> Command_Runner
Chaining_Orchestrator -- "manages" --> Command_Object
The delegator library's architecture is centered around the Delegator API (Facade), which serves as the primary user interface. This Facade exposes two key functionalities: the Command Runner (delegator.run) for executing single commands, and the Chaining Orchestrator (delegator.chain) for managing sequences of commands. The Command Runner is responsible for instantiating the fundamental Command Object, which encapsulates the details of an external process. Each Command Object provides a Piping Mechanism (Command.pipe) that allows its output to be directed as input to another Command Object, facilitating shell-like piping. The Chaining Orchestrator orchestrates the execution of multiple Command Objects, often utilizing the Command Runner to create them, to achieve complex command workflows.
The central, user-facing facade that provides a simplified API for running, interacting with, and managing external commands. It serves as the primary entry point for users, exposing core functionalities like direct command execution and command chaining.
Related Classes/Methods:
Responsible for initiating new command executions by creating and managing individual Command instances. It handles the direct execution of a single external command, returning a Command Object for further interaction.
Related Classes/Methods:
The core abstraction representing an executed external command. It encapsulates the subprocess, its state (e.g., return code, running status), and I/O streams (stdout, stderr, stdin). This object provides methods for managing and interacting with the command, including piping its output.
Related Classes/Methods:
A method of the Command Object that enables the chaining of commands by directing the standard output of one command to the standard input of another. It manages the data flow between sequentially executed commands, effectively simulating shell pipes.
Related Classes/Methods:
A top-level function exposed by the Delegator API (Facade) that manages the sequential execution of multiple commands. It handles their overall flow and potential inter-command data transfer, ensuring commands are run in a specified order and their outcomes are managed.
Related Classes/Methods: