feat: add compose ps command
Ps is new command scoped under compose. It is just proxy to `docker compose ps`.
This commit is contained in:
parent
b45cfd3e0a
commit
e061d6dc6c
|
@ -20,6 +20,9 @@ pub enum DockerCompose {
|
||||||
rest: Vec<String>,
|
rest: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Print services
|
||||||
|
Ps,
|
||||||
|
|
||||||
/// Stop, build and start containers.
|
/// Stop, build and start containers.
|
||||||
Rebuild,
|
Rebuild,
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ impl CommandBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build(self) -> Result<Command> {
|
fn build(self) -> Result<Command> {
|
||||||
debug_println!("\nran {self}\n");
|
debug_println!("-----\n{self}\n-----");
|
||||||
|
|
||||||
let (first, rest) = self.args.split_first().context("empty args")?;
|
let (first, rest) = self.args.split_first().context("empty args")?;
|
||||||
let mut command = Command::new(first);
|
let mut command = Command::new(first);
|
||||||
|
|
|
@ -30,6 +30,7 @@ fn main() -> Result<()> {
|
||||||
cli::DockerCompose::Build => scripts::docker_compose::build(),
|
cli::DockerCompose::Build => scripts::docker_compose::build(),
|
||||||
cli::DockerCompose::Down => scripts::docker_compose::down(),
|
cli::DockerCompose::Down => scripts::docker_compose::down(),
|
||||||
cli::DockerCompose::Exec { rest } => scripts::docker_compose::exec(&rest),
|
cli::DockerCompose::Exec { rest } => scripts::docker_compose::exec(&rest),
|
||||||
|
cli::DockerCompose::Ps => scripts::docker_compose::ps(),
|
||||||
cli::DockerCompose::Rebuild => scripts::docker_compose::rebuild(),
|
cli::DockerCompose::Rebuild => scripts::docker_compose::rebuild(),
|
||||||
cli::DockerCompose::Restart => scripts::docker_compose::restart(),
|
cli::DockerCompose::Restart => scripts::docker_compose::restart(),
|
||||||
cli::DockerCompose::Start => scripts::docker_compose::start(None),
|
cli::DockerCompose::Start => scripts::docker_compose::start(None),
|
||||||
|
|
|
@ -18,6 +18,10 @@ pub fn exec(rest: &[String]) -> Result<()> {
|
||||||
.exec()
|
.exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ps() -> Result<()> {
|
||||||
|
CommandBuilder::docker_compose().args("ps").exec()
|
||||||
|
}
|
||||||
|
|
||||||
/// Start containers via `docker compose start`. Optionally pass containers to be started.
|
/// Start containers via `docker compose start`. Optionally pass containers to be started.
|
||||||
/// ```
|
/// ```
|
||||||
/// start(None);
|
/// start(None);
|
||||||
|
|
Loading…
Reference in New Issue