diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/endpoint.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/commands/endpoint.rs b/src/commands/endpoint.rs index ec5b2ef..14a4927 100644 --- a/src/commands/endpoint.rs +++ b/src/commands/endpoint.rs @@ -191,6 +191,7 @@ async fn container(endpoint_names: Vec<String>, Some(("top", matches)) => container_top(matches, relevant_endpoint, container_id).await, Some(("kill", matches)) => container_kill(matches, relevant_endpoint, container_id).await, Some(("delete", _)) => container_delete(relevant_endpoint, container_id).await, + Some(("start", _)) => container_start(relevant_endpoint, container_id).await, Some((other, _)) => Err(anyhow!("Unknown subcommand: {}", other)), None => Err(anyhow!("No subcommand")), } @@ -252,6 +253,22 @@ async fn container_delete( .map_err(Error::from) } +async fn container_start( + endpoint: &Endpoint, + container_id: &str, +) -> Result<()> { + let prompt = format!("Really start {}?", container_id); + dialoguer::Confirm::new().with_prompt(prompt).interact()?; + + endpoint + .get_container_by_id(container_id) + .await? + .ok_or_else(|| anyhow!("Cannot find container {} on {}", container_id, endpoint.name()))? + .start() + .await + .map_err(Error::from) +} + async fn containers(endpoint_names: Vec<String>, matches: &ArgMatches, |