summaryrefslogtreecommitdiffstats
path: root/examples/imageinspect.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/imageinspect.rs')
-rw-r--r--examples/imageinspect.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/examples/imageinspect.rs b/examples/imageinspect.rs
index 50144f0..0cd8450 100644
--- a/examples/imageinspect.rs
+++ b/examples/imageinspect.rs
@@ -1,12 +1,20 @@
extern crate shiplift;
+extern crate tokio;
use shiplift::Docker;
use std::env;
+use tokio::prelude::Future;
fn main() {
let docker = Docker::new();
- if let Some(id) = env::args().nth(1) {
- let image = docker.images().get(&id).inspect().unwrap();
- println!("{:?}", image);
- }
+ let id = env::args()
+ .nth(1)
+ .expect("Usage: cargo run --example imageinspect -- <image>");
+ let fut = docker
+ .images()
+ .get(&id)
+ .inspect()
+ .map(|image| println!("{:#?}", image))
+ .map_err(|e| eprintln!("Error: {}", e));
+ tokio::run(fut);
}