diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-02-24 14:10:31 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-03-11 16:21:33 +0100 |
commit | e9587ced288083bb0ff5c0b8af97746d8eb30d26 (patch) | |
tree | 5dbe4ffcc076f0c7b3f108d15b5ffefa008f2185 /imag-view | |
parent | d99d38bf8e963942280bc376399bcc1eec4468e3 (diff) |
Implement view_versions_of()
Diffstat (limited to 'imag-view')
-rw-r--r-- | imag-view/src/main.rs | 29 |
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!"); + } } |