Files
ahab/src/scripts/docker.rs
Matej Janežič 316b37cd05 feat: custom command builder
Implemented custom command builder with nicer api suited for my needs.
Also returned error if there are no containers in
`scripts::postgres::get_containers`.
2023-06-02 17:18:25 +02:00

16 lines
358 B
Rust

use anyhow::Result;
use crate::command_builder::CommandBuilder;
pub fn stop_all() -> Result<()> {
let running_containers = CommandBuilder::docker().args("ps -q").exec_get_stdout()?;
if running_containers.is_empty() {
return Ok(());
}
CommandBuilder::docker()
.args(&format!("stop {running_containers}"))
.exec()
}