summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorsoftprops <d.tangren@gmail.com>2018-12-24 13:45:42 +0900
committersoftprops <d.tangren@gmail.com>2018-12-24 13:45:42 +0900
commitfcc4f7b9c648290887d90c5d8fe91b70e594870d (patch)
tree714f0a2406dea7372a5b3bfda8227fe03e20125e /examples
parent7d5672fbe1089ef5b02375f7f3f77fe5257e4ec5 (diff)
maint details
Diffstat (limited to 'examples')
-rw-r--r--examples/imagepull.rs3
-rw-r--r--examples/images.rs2
-rw-r--r--examples/imagesearch.rs17
-rw-r--r--examples/stats.rs1
4 files changed, 22 insertions, 1 deletions
diff --git a/examples/imagepull.rs b/examples/imagepull.rs
index a9c5b36..84a6149 100644
--- a/examples/imagepull.rs
+++ b/examples/imagepull.rs
@@ -1,8 +1,11 @@
+// cargo run --example imagepull busybox
+
use shiplift::{Docker, PullOptions};
use std::env;
use tokio::prelude::{Future, Stream};
fn main() {
+ env_logger::init();
let docker = Docker::new();
let img = env::args()
.nth(1)
diff --git a/examples/images.rs b/examples/images.rs
index e68c9bb..ab36b3d 100644
--- a/examples/images.rs
+++ b/examples/images.rs
@@ -9,7 +9,7 @@ fn main() {
.list(&Default::default())
.map(|images| {
for i in images {
- println!("{:?}", i.repo_tags);
+ println!("{:?}", i.repo_tags.unwrap_or_else(|| vec!["none".into()]));
}
})
.map_err(|e| eprintln!("Error: {}", e));
diff --git a/examples/imagesearch.rs b/examples/imagesearch.rs
new file mode 100644
index 0000000..a6d6e52
--- /dev/null
+++ b/examples/imagesearch.rs
@@ -0,0 +1,17 @@
+use shiplift::Docker;
+use tokio::prelude::Future;
+
+fn main() {
+ let docker = Docker::new();
+ println!("remote docker images in stock");
+ let fut = docker
+ .images()
+ .search("rust")
+ .map(|results| {
+ for result in results {
+ println!("{} - {}", result.name, result.description);
+ }
+ })
+ .map_err(|e| eprintln!("Error: {}", e));
+ tokio::run(fut);
+}
diff --git a/examples/stats.rs b/examples/stats.rs
index 5e03f20..9e14cf4 100644
--- a/examples/stats.rs
+++ b/examples/stats.rs
@@ -1,3 +1,4 @@
+// cargo run --example stats -- <container>
use shiplift::Docker;
use std::env;
use tokio::prelude::{Future, Stream};