summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-03-16 16:33:47 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-03-16 16:33:47 +0100
commit2a87bc045d3fb6c7d576cb7709984d810fd08a11 (patch)
treece00925d2b8103dd753641196dd9a921ffc75f18
parent040b19ea29212375d5cb308791bacd77f27ab3b9 (diff)
parent91adbd08d2b781cd13bac49bce5fd87aa1908767 (diff)
Merge branch 'fix-confirm'
-rw-r--r--src/commands/endpoint_container.rs32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/commands/endpoint_container.rs b/src/commands/endpoint_container.rs
index 962b62c..abaf49e 100644
--- a/src/commands/endpoint_container.rs
+++ b/src/commands/endpoint_container.rs
@@ -73,23 +73,33 @@ pub async fn container(endpoint_names: Vec<EndpointName>,
kill(matches, container).await
},
Some(("delete", _)) => {
- confirm(format!("Really delete {}?", container_id))?;
- delete(container).await
+ if confirm(format!("Really delete {}?", container_id))? {
+ delete(container).await
+ } else {
+ Ok(())
+ }
},
Some(("start", _)) => {
- confirm(format!("Really start {}?", container_id))?;
- start(container).await
+ if confirm(format!("Really start {}?", container_id))? {
+ start(container).await
+ } else {
+ Ok(())
+ }
},
Some(("stop", matches)) => {
- confirm(format!("Really stop {}?", container_id))?;
- stop(matches, container).await
+ if confirm(format!("Really stop {}?", container_id))? {
+ stop(matches, container).await
+ } else {
+ Ok(())
+ }
},
Some(("exec", matches)) => {
- confirm({
- let commands = matches.values_of("commands").unwrap().collect::<Vec<&str>>();
- format!("Really run '{}' in {}?", commands.join(" "), container_id)
- })?;
- exec(matches, container).await
+ let commands = matches.values_of("commands").unwrap().collect::<Vec<&str>>();
+ if confirm(format!("Really run '{}' in {}?", commands.join(" "), container_id))? {
+ exec(matches, container).await
+ } else {
+ Ok(())
+ }
},
Some(("inspect", _)) => inspect(container).await,
Some((other, _)) => Err(anyhow!("Unknown subcommand: {}", other)),