anton-rs / op-up

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

feat(bin): Nuke Subcommand #19

Open refcell opened 12 months ago

refcell commented 12 months ago

Description

As part of #17, this task is to introduce a convenience nuke subcommand that nukes all running op-up stack components (including cleaning/pruning any docker containers, images, and volumes). Since this is a destructive command, it should use inquire to prompt the user to confirm that they want to perform the given actions (described in detail before the confirmation prompt).

Nuking logic should be entirely handled by the StageManager system orchestrator.

The extent of how to nuke stacks should be managed through cli flags and passed into the StageManager when executing the nuke() call. Since nuking also involves the local stack, the opup cli binary should build the StageManager from the config, and then call nuke() -> eyre::Result<()>. How the nuke cli flags are configured in the StageManager when building from the config or passing them directly in the nuke() call as arguments is an implementation detail, that is up to the implementor.

For example

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

Since the cli binary logic is minimal, it should be placed inside the cli.rs file where subcommand dispatching is handled.