diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/zot/group.rs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/examples/zot/group.rs b/examples/zot/group.rs index 71f60d6..6bb3839 100644 --- a/examples/zot/group.rs +++ b/examples/zot/group.rs @@ -24,11 +24,26 @@ pub fn list(data: &str) { println!("----+------------------+-----+-------+-------------------------"); for group in groups { - println!("{:4} | {:16} | {:3} | | {}", - group["id"], - group["gname"], - group["uid"], - group["hash"]) + let mut flags = String::new(); + + if let Some(visible) = group["visible"].as_u64() { + if visible != 0 { + flags += "v"; + } + } + + if let Some(deleted) = group["deleted"].as_u64() { + if deleted != 0 { + flags += "d"; + } + } + + print!("{:>3} | {:16} | {:>3} | {:5} | {}\n", + group["id"].as_u64().unwrap(), + group["gname"].as_str().unwrap(), + group["uid"].as_u64().unwrap(), + flags, + group["hash"].as_str().unwrap()); } } else { |