summaryrefslogtreecommitdiffstats
path: root/imag-view
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-02-24 14:10:31 +0100
committerMatthias Beyer <mail@beyermatthias.de>2016-03-11 16:21:33 +0100
commite9587ced288083bb0ff5c0b8af97746d8eb30d26 (patch)
tree5dbe4ffcc076f0c7b3f108d15b5ffefa008f2185 /imag-view
parentd99d38bf8e963942280bc376399bcc1eec4468e3 (diff)
Implement view_versions_of()
Diffstat (limited to 'imag-view')
-rw-r--r--imag-view/src/main.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/imag-view/src/main.rs b/imag-view/src/main.rs
index 137d57b6..7a2d4bd6 100644
--- a/imag-view/src/main.rs
+++ b/imag-view/src/main.rs
@@ -124,6 +124,33 @@ fn load_entry<'a>(id: &str,
}
fn view_versions_of(id: &str, rt: &Runtime) {
- unimplemented!()
+ use glob::glob;
+
+ let mut path = rt.store().path().clone();
+
+ if id.chars().next() == Some('/') {
+ path.push(format!("{}~*", &id[1..id.len()]));
+ } else {
+ path.push(format!("{}~*", id));
+ }
+
+ if let Some(path) = path.to_str() {
+ match glob(path) {
+ Ok(paths) =>
+ for entry in paths {
+ match entry {
+ Ok(path) => println!("{}", path.file_name().and_then(|s| s.to_str()).unwrap()),
+ Err(e) => trace_error(e.error()),
+ }
+ },
+ Err(e) => {
+ // trace_error(&e); // error seems not to be implemented
+ debug!("Error in pattern");
+ exit(1);
+ },
+ }
+ } else {
+ warn!("Could not build glob() argument!");
+ }
}