aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bin/zot/zot/channel_stream.rs27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/bin/zot/zot/channel_stream.rs b/src/bin/zot/zot/channel_stream.rs
index bad7152..33ad7cf 100644
--- a/src/bin/zot/zot/channel_stream.rs
+++ b/src/bin/zot/zot/channel_stream.rs
@@ -40,7 +40,6 @@ fn list(payload: &str) {
Ok(serde_json::Value::Array(v)) => {
for item in v.into_iter() {
print_item(&item);
- println!("-----");
}
}
Ok(_) => println!("Wrong type returned, expected an array."),
@@ -93,12 +92,22 @@ fn get_tags(item: &serde_json::Value) -> String {
fn print_item(item: &serde_json::Value) {
let author = &item["author"];
- print!("{} ", get_str(&item["created"]));
- print!("{} ", get_str(&author["name"]));
- println!("{} a {}", get_verb(&item), get_object_type(&item));
- println!("URL: {}", get_str(&author["url"]));
- println!("Proto: {}", get_str(&author["network"]));
- println!("Title: {}", get_str(&item["title"]));
- println!("Tags : {}", get_tags(&item));
- println!("Message:\n{}", get_str(&item["body"]));
+
+ println!("{} {} {} a {}:",
+ get_str(&item["created"]),
+ get_str(&author["name"]),
+ get_verb(&item),
+ get_object_type(&item));
+
+ let title = get_str(&item["title"]);
+ if title.len() > 0 {
+ println!("Title: {}", get_str(&item["title"]));
+ }
+
+ let tags = get_tags(&item);
+ if tags.len() > 0 {
+ println!("Tags : {}", get_tags(&item));
+ }
+
+ println!("\n{}\n", get_str(&item["body"]));
}