anton-rs / op-up

Composable OP Stack Orchestration
https://stack.anton.systems
MIT License
41 stars 2 forks source link

feat(bin): Clean Subcommand #20

Open refcell opened 12 months ago

refcell commented 12 months ago

Description

As part of #17, this task is to introduce a new clean subcommand to op-up that cleans stack artifacts and any additional generated files.

The logic of cleaning a stack based on the config should be abstracted into the Stage Manager orchestrator (doesn't exist yet). This allows the opup cli binary to build the stage manager from the config, and then be able to clean the stack via a simple clean() -> eyre::Result<()> call.

For example

StageManager::from(config).clean()?;

The logic behind building a stage manager orchestrator from the stack config is so that it can handle finding existing running stack components based on the configuration. This separates concerns whereby the stack configuration solely handles component and stack configuration while the stage manager can handle orchestrating the stack stages/components.

Since this logic should be minimal, it can be placed inside cli.rs alongside subcommand dispatching.