summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-09-05 16:10:47 +0200
committerGitHub <noreply@github.com>2016-09-05 16:10:47 +0200
commit737aab80dc029315d412ff781f20e9afd8db55ae (patch)
tree44d36cca30efa87b6964c185c46f75a7bd2fb043
parentdfcc5c6a0e5bde7c5ed3ba40e3f6376b9e7d0a96 (diff)
parent07d4c45b3f21f07416f3d19bde122f11095467b4 (diff)
Merge pull request #667 from matthiasbeyer/rewrite-storeid-type
Rewrite storeid type
-rw-r--r--imag-diary/src/list.rs14
-rw-r--r--imag-link/Cargo.toml3
-rw-r--r--imag-link/src/main.rs41
-rw-r--r--imag-store/src/create.rs29
-rw-r--r--imag-store/src/delete.rs7
-rw-r--r--imag-store/src/get.rs7
-rw-r--r--imag-store/src/retrieve.rs7
-rw-r--r--imag-store/src/update.rs6
-rw-r--r--imag-store/tests/001-create_test.sh28
-rw-r--r--imag-store/tests/002-retrieve_test.sh20
-rw-r--r--imag-store/tests/003-delete_test.sh6
-rw-r--r--imag-tag/src/main.rs22
-rw-r--r--imag-view/src/main.rs5
-rw-r--r--imag-view/src/ui.rs6
-rw-r--r--libimagbookmark/src/collection.rs15
-rw-r--r--libimagbookmark/src/lib.rs2
-rw-r--r--libimagcounter/src/counter.rs20
-rw-r--r--libimagcounter/src/error.rs1
-rw-r--r--libimagcounter/src/lib.rs2
-rw-r--r--libimagdiary/src/diary.rs4
-rw-r--r--libimagdiary/src/diaryid.rs3
-rw-r--r--libimagdiary/src/is_in_diary.rs9
-rw-r--r--libimagdiary/src/lib.rs2
-rw-r--r--libimagentrylink/src/error.rs3
-rw-r--r--libimagentrylink/src/external.rs12
-rw-r--r--libimagentrylink/src/internal.rs50
-rw-r--r--libimagentrylink/src/lib.rs2
-rw-r--r--libimagentrylist/src/listers/line.rs4
-rw-r--r--libimagentrylist/src/listers/path.rs2
-rw-r--r--libimagentryselect/src/error.rs13
-rw-r--r--libimagentryselect/src/lib.rs3
-rw-r--r--libimagentryselect/src/result.rs6
-rw-r--r--libimagentryselect/src/ui.rs47
-rw-r--r--libimagentryview/src/builtin/mod.rs1
-rw-r--r--libimagentryview/src/builtin/versions.rs54
-rw-r--r--libimagnotes/src/error.rs1
-rw-r--r--libimagnotes/src/lib.rs2
-rw-r--r--libimagnotes/src/note.rs34
-rw-r--r--libimagref/src/lib.rs2
-rw-r--r--libimagref/src/reference.rs27
-rw-r--r--libimagstore/src/error.rs1
-rw-r--r--libimagstore/src/store.rs149
-rw-r--r--libimagstore/src/storeid.rs169
-rw-r--r--libimagstorestdhook/src/flock.rs24
-rw-r--r--libimagstorestdhook/src/linkverify.rs10
-rw-r--r--libimagtodo/src/error.rs1
-rw-r--r--libimagtodo/src/lib.rs2
-rw-r--r--libimagtodo/src/task.rs56
48 files changed, 473 insertions, 461 deletions
diff --git a/imag-diary/src/list.rs b/imag-diary/src/list.rs
index 9c0cc3c5..6ec43dcf 100644
--- a/imag-diary/src/list.rs
+++ b/imag-diary/src/list.rs
@@ -1,4 +1,3 @@
-use std::path::PathBuf;
use std::process::exit;
use libimagdiary::diary::Diary;
@@ -8,7 +7,6 @@ use libimagentrylist::listers::core::CoreLister;
use libimagentrylist::lister::Lister;
use libimagrt::runtime::Runtime;
use libimagstore::store::Entry;
-use libimagstore::storeid::StoreId;
use libimagerror::trace::trace_error;
use util::get_diary_name;
@@ -21,11 +19,11 @@ pub fn list(rt: &Runtime) {
}
let diaryname = diaryname.unwrap();
- fn location_to_listing_string(id: &StoreId, base: &PathBuf) -> String {
- id.strip_prefix(base)
+ fn entry_to_location_listing_string(e: &Entry) -> String {
+ e.get_location().clone()
+ .without_base()
+ .to_str()
.map_err(|e| trace_error(&e))
- .ok()
- .and_then(|p| p.to_str().map(String::from))
.unwrap_or(String::from("<<Path Parsing Error>>"))
}
@@ -40,9 +38,7 @@ pub fn list(rt: &Runtime) {
a.ok()
}).map(|e| e.into());
- let base = rt.store().path();
-
- CoreLister::new(&move |e: &Entry| location_to_listing_string(e.get_location(), base))
+ CoreLister::new(&entry_to_location_listing_string)
.list(es) // TODO: Do not ignore non-ok()s
.map_err(|e| DE::new(DEK::IOError, Some(Box::new(e))))
})
diff --git a/imag-link/Cargo.toml b/imag-link/Cargo.toml
index ed215bc5..96615b6c 100644
--- a/imag-link/Cargo.toml
+++ b/imag-link/Cargo.toml
@@ -23,3 +23,6 @@ path = "../libimagentrylink"
[dependencies.libimagerror]
path = "../libimagerror"
+[dependencies.libimagutil]
+path = "../libimagutil"
+
diff --git a/imag-link/src/main.rs b/imag-link/src/main.rs
index c1448678..fd8d9d5d 100644
--- a/imag-link/src/main.rs
+++ b/imag-link/src/main.rs
@@ -24,6 +24,7 @@ extern crate libimagentrylink;
extern crate libimagrt;
extern crate libimagstore;
extern crate libimagerror;
+extern crate libimagutil;
use std::process::exit;
use std::ops::Deref;
@@ -36,6 +37,7 @@ use libimagstore::store::FileLockEntry;
use libimagstore::store::Store;
use libimagerror::trace::{trace_error, trace_error_exit};
use libimagentrylink::external::ExternalLinker;
+use libimagutil::warn_result::*;
use clap::ArgMatches;
use url::Url;
@@ -74,10 +76,19 @@ fn handle_internal_linking(rt: &Runtime) {
for entry in cmd.value_of("list").unwrap().split(',') {
debug!("Listing for '{}'", entry);
match get_entry_by_name(rt, entry) {
- Ok(e) => {
+ Ok(Some(e)) => {
e.get_internal_links()
.map(|links| {
- for (i, link) in links.iter().map(|l| l.to_str()).filter_map(|x| x).enumerate() {
+ let i = links
+ .iter()
+ .filter_map(|l| {
+ l.to_str()
+ .map_warn_err(|e| format!("Failed to convert StoreId to string: {:?}", e))
+ .ok()
+ })
+ .enumerate();
+
+ for (i, link) in i {
println!("{: <3}: {}", i, link);
}
})
@@ -85,6 +96,11 @@ fn handle_internal_linking(rt: &Runtime) {
.ok();
},
+ Ok(None) => {
+ warn!("Entry not found: {:?}", entry);
+ break;
+ }
+
Err(e) => {
trace_error(&e);
break;
@@ -148,7 +164,8 @@ fn get_from_entry<'a>(rt: &'a Runtime) -> Option<FileLockEntry<'a>> {
debug!("We couldn't get the entry from name: '{:?}'", from_name);
trace_error(&e); None
},
- Ok(e) => Some(e),
+ Ok(Some(e)) => Some(e),
+ Ok(None) => None,
}
})
@@ -166,17 +183,20 @@ fn get_to_entries<'a>(rt: &'a Runtime) -> Option<Vec<FileLockEntry<'a>>> {
for entry in values.map(|v| get_entry_by_name(rt, v)) {
match entry {
Err(e) => trace_error(&e),
- Ok(e) => v.push(e),
+ Ok(Some(e)) => v.push(e),
+ Ok(None) => warn!("Entry not found: {:?}", v),
}
}
v
})
}
-fn get_entry_by_name<'a>(rt: &'a Runtime, name: &str) -> Result<FileLockEntry<'a>, StoreError> {
- use libimagstore::storeid::build_entry_path;
- build_entry_path(rt.store(), name)
- .and_then(|path| rt.store().retrieve(path))
+fn get_entry_by_name<'a>(rt: &'a Runtime, name: &str) -> Result<Option<FileLockEntry<'a>>, StoreError> {
+ use std::path::PathBuf;
+ use libimagstore::storeid::StoreId;
+
+ StoreId::new(Some(rt.store().path().clone()), PathBuf::from(name))
+ .and_then(|id| rt.store().get(id))
}
fn handle_external_linking(rt: &Runtime) {
@@ -186,6 +206,11 @@ fn handle_external_linking(rt: &Runtime) {
if entry.is_err() {
trace_error_exit(&entry.unwrap_err(), 1);
}
+ let entry = entry.unwrap();
+ if entry.is_none() {
+ warn!("Entry not found: {:?}", entry_name);
+ return;
+ }
let mut entry = entry.unwrap();
if scmd.is_present("add") {
diff --git a/imag-store/src/create.rs b/imag-store/src/create.rs
index 7329df3f..0380ddf5 100644
--- a/imag-store/src/create.rs
+++ b/imag-store/src/create.rs
@@ -13,8 +13,9 @@ use clap::ArgMatches;
use libimagrt::runtime::Runtime;
use libimagstore::store::Entry;
use libimagstore::store::EntryHeader;
-use libimagstore::storeid::build_entry_path;
+use libimagstore::storeid::StoreId;
use libimagerror::trace::trace_error_exit;
+use libimagutil::debug_result::*;
use error::StoreError;
use error::StoreErrorKind;
@@ -36,13 +37,15 @@ pub fn create(rt: &Runtime) {
exit(1);
}
- let path = match build_entry_path(rt.store(), path.unwrap()) {
+ let store_path = rt.store().path().clone();
+ let path = match StoreId::new(Some(store_path), PathBuf::from(path.unwrap())) {
Err(e) => trace_error_exit(&e, 1),
- Ok(p) => p,
+ Ok(o) => o,
};
debug!("path = {:?}", path);
if scmd.subcommand_matches("entry").is_some() {
+ debug!("Creating entry from CLI specification");
create_from_cli_spec(rt, scmd, &path)
.or_else(|_| create_from_source(rt, scmd, &path))
.or_else(|_| create_with_content_and_header(rt,
@@ -50,13 +53,17 @@ pub fn create(rt: &Runtime) {
String::new(),
EntryHeader::new()))
} else {
+ debug!("Creating entry");
create_with_content_and_header(rt, &path, String::new(), EntryHeader::new())
}
- .unwrap_or_else(|e| debug!("Error building Entry: {:?}", e))
+ .unwrap_or_else(|e| {
+ error!("Error building Entry");
+ trace_error_exit(&e, 1);
+ })
});
}
-fn create_from_cli_spec(rt: &Runtime, matches: &ArgMatches, path: &PathBuf) -> Result<()> {
+fn create_from_cli_spec(rt: &Runtime, matches: &ArgMatches, path: &StoreId) -> Result<()> {
let content = matches.subcommand_matches("entry")
.map_or_else(|| {
debug!("Didn't find entry subcommand, getting raw content");
@@ -80,7 +87,7 @@ fn create_from_cli_spec(rt: &Runtime, matches: &ArgMatches, path: &PathBuf) -> R
create_with_content_and_header(rt, path, content, header)
}
-fn create_from_source(rt: &Runtime, matches: &ArgMatches, path: &PathBuf) -> Result<()> {
+fn create_from_source(rt: &Runtime, matches: &ArgMatches, path: &StoreId) -> Result<()> {
let content = matches
.value_of("from-raw")
.ok_or(StoreError::new(StoreErrorKind::NoCommandlineCall, None))
@@ -93,9 +100,11 @@ fn create_from_source(rt: &Runtime, matches: &ArgMatches, path: &PathBuf) -> Res
debug!("Content with len = {}", content.len());
Entry::from_str(path.clone(), &content[..])
+ .map_dbg_err(|e| format!("Error building entry: {:?}", e))
.and_then(|new_e| {
let r = rt.store()
.create(path.clone())
+ .map_dbg_err(|e| format!("Error in Store::create(): {:?}", e))
.map(|mut old_e| {
*old_e.deref_mut() = new_e;
});
@@ -103,17 +112,19 @@ fn create_from_source(rt: &Runtime, matches: &ArgMatches, path: &PathBuf) -> Res
debug!("Entry build");
r
})
+ .map_dbg_err(|e| format!("Error storing entry: {:?}", e))
.map_err(|serr| StoreError::new(StoreErrorKind::BackendError, Some(Box::new(serr))))
}
fn create_with_content_and_header(rt: &Runtime,
- path: &PathBuf,
+ path: &StoreId,
content: String,
header: EntryHeader) -> Result<()>
{
- debug!("Creating entry with content");
+ debug!("Creating entry with content at {:?}", path);
rt.store()
- .create(PathBuf::from(path))
+ .create(path.clone())
+ .map_dbg_err(|e| format!("Error in Store::create(): {:?}", e))
.map(|mut element| {
{
let mut e_content = element.get_content_mut();
diff --git a/imag-store/src/delete.rs b/imag-store/src/delete.rs
index 46626816..537b638d 100644
--- a/imag-store/src/delete.rs
+++ b/imag-store/src/delete.rs
@@ -1,6 +1,8 @@
-use libimagstore::storeid::build_entry_path;
+use std::path::PathBuf;
+
use libimagrt::runtime::Runtime;
use libimagerror::trace::trace_error_exit;
+use libimagstore::storeid::StoreId;
pub fn delete(rt: &Runtime) {
use std::process::exit;
@@ -10,7 +12,8 @@ pub fn delete(rt: &Runtime) {
.map(|sub| {
sub.value_of("id")
.map(|id| {
- let path = try!(build_entry_path(rt.store(), id)
+ let path = PathBuf::from(id);
+ let path = try!(StoreId::new(Some(rt.store().path().clone()), path)
.map_err(|e| trace_error_exit(&e, 1)));
debug!("Deleting file at {:?}", id);
diff --git a/imag-store/src/get.rs b/imag-store/src/get.rs
index 3e33ac2b..1302b763 100644
--- a/imag-store/src/get.rs
+++ b/imag-store/src/get.rs
@@ -1,6 +1,8 @@
-use libimagstore::storeid::build_entry_path;
+use std::path::PathBuf;
+
use libimagrt::runtime::Runtime;
use libimagerror::trace::{trace_error, trace_error_exit};
+use libimagstore::storeid::StoreId;
use retrieve::print_entry;
@@ -10,7 +12,8 @@ pub fn get(rt: &Runtime) {
.map(|scmd| {
scmd.value_of("id")
.map(|id| {
- let path = match build_entry_path(rt.store(), id) {
+ let path = PathBuf::from(id);
+ let path = match StoreId::new(Some(rt.store().path().clone()), path) {
Err(e) => trace_error_exit(&e, 1),
Ok(p) => p,
};
diff --git a/imag-store/src/retrieve.rs b/imag-store/src/retrieve.rs
index f9f45993..39b66741 100644
--- a/imag-store/src/retrieve.rs
+++ b/imag-store/src/retrieve.rs
@@ -1,8 +1,10 @@
+use std::path::PathBuf;
+
use clap::ArgMatches;
use toml::Value;
use libimagstore::store::FileLockEntry;
-use libimagstore::storeid::build_entry_path;
+use libimagstore::storeid::StoreId;
use libimagrt::runtime::Runtime;
use libimagerror::trace::{trace_error, trace_error_exit};
@@ -12,7 +14,8 @@ pub fn retrieve(rt: &Runtime) {
.map(|scmd| {
scmd.value_of("id")
.map(|id| {
- let path = try!(build_entry_path(rt.store(), id)
+ let path = PathBuf::from(id);
+ let path = try!(StoreId::new(Some(rt.store().path().clone()), path)
.map_err(|e| trace_error_exit(&e, 1)));
debug!("path = {:?}", path);
diff --git a/imag-store/src/update.rs b/imag-store/src/update.rs
index 9959ec09..87279dc0 100644
--- a/imag-store/src/update.rs
+++ b/imag-store/src/update.rs
@@ -1,8 +1,9 @@
use std::ops::DerefMut;
+use std::path::PathBuf;
use libimagrt::runtime::Runtime;
-use libimagstore::storeid::build_entry_path;
use libimagerror::trace::trace_error_exit;
+use libimagstore::storeid::StoreId;
use util::build_toml_header;
@@ -12,7 +13,8 @@ pub fn update(rt: &Runtime) {
.map(|scmd| {
scmd.value_of("id")
.map(|id| {
- let path = match build_entry_path(rt.store(), id) {
+ let path = PathBuf::from(id);
+ let path = match StoreId::new(Some(rt.store().path().clone()), path) {
Err(e) => trace_error_exit(&e, 1),
Ok(p) => p,
};
diff --git a/imag-store/tests/001-create_test.sh b/imag-store/tests/001-create_test.sh
index 4f767c7d..3d030b34 100644
--- a/imag-store/tests/001-create_test.sh
+++ b/imag-store/tests/001-create_test.sh
@@ -4,7 +4,7 @@ source $(dirname ${BASH_SOURCE[0]})/../../tests/utils.sh
source $(dirname ${BASH_SOURCE[0]})/utils.sh
test_call() {
- imag-store create -p /test-call~0.2.0
+ imag-store create -p test-call
if [[ ! $? -eq 0 ]]; then
err "Return value should be zero, was non-zero"
return 1;
@@ -12,7 +12,7 @@ test_call() {
}
test_call_id() {
- imag-store create -i /test-call~0.2.0
+ imag-store create -i test-call
if [[ ! $? -eq 0 ]]; then
err "Return value should be zero, was non-zero"
return 1;
@@ -28,7 +28,7 @@ test_call_no_id() {
}
test_mkstore() {
- imag-store create -p /test-mkstore~0.2.0 || { err "Calling imag failed"; return 1; }
+ imag-store create -p test-mkstore || { err "Calling imag failed"; return 1; }
if [[ -d ${STORE} ]]; then
out "Store exists."
else
@@ -48,12 +48,12 @@ version = "0.2.0"
EOS
)
- imag-store create -p /test-std-header~0.2.0
- local result=$(cat ${STORE}/test-std-header~0.2.0)
+ imag-store create -p test-std-header
+ local result=$(cat ${STORE}/test-std-header)
if [[ "$expected" == "$result" ]]; then
out "Expected store entry == result"
else
- err "${STORE}/test-std-header~0.2.0 differs from expected"
+ err "${STORE}/test-std-header differs from expected"
return 1
fi
}
@@ -72,8 +72,8 @@ zzz = "z"
EOS
)
- imag-store create -p /test-std-header-plus-custom~0.2.0 entry -h zzz.zzz=z
- local result=$(cat ${STORE}/test-std-header-plus-custom~0.2.0)
+ imag-store create -p test-std-header-plus-custom entry -h zzz.zzz=z
+ local result=$(cat ${STORE}/test-std-header-plus-custom)
if [[ "$expected" == "$result" ]]; then
out "Expected store entry == result"
else
@@ -99,8 +99,8 @@ zzz = "z"
EOS
)
- local filename="test-std-header-plus-custom-multiheader~0.2.0"
- imag-store create -p /$filename entry -h zzz.zzz=z foo.bar=baz
+ local filename="test-std-header-plus-custom-multiheader"
+ imag-store create -p $filename entry -h zzz.zzz=z foo.bar=baz
local result=$(cat ${STORE}/$filename)
if [[ "$expected" == "$result" ]]; then
out "Expected store entry == result"
@@ -126,8 +126,8 @@ zzz = "z"
EOS
)
- local filename="test-std-header-plus-custom-mutliheader-same-section~0.2.0"
- imag-store create -p /$filename entry -h zzz.zzz=z zzz.bar=baz
+ local filename="test-std-header-plus-custom-mutliheader-same-section"
+ imag-store create -p $filename entry -h zzz.zzz=z zzz.bar=baz
local result=$(cat ${STORE}/$filename)
if [[ "$expected" == "$result" ]]; then
out "Expected store entry == result"
@@ -151,8 +151,8 @@ content
EOS
)
- local name="test-std-header-plus-custom-and-content~0.2.0"
- imag-store create -p /$name entry -h zzz.zzz=z -c content
+ local name="test-std-header-plus-custom-and-content"
+ imag-store create -p $name entry -h zzz.zzz=z -c content
local result=$(cat ${STORE}/$name)
if [[ "$expected" == "$result" ]]; then
out "Expected store entry == result"
diff --git a/imag-store/tests/002-retrieve_test.sh b/imag-store/tests/002-retrieve_test.sh
index 01fcfd3e..1e6e7203 100644
--- a/imag-store/tests/002-retrieve_test.sh
+++ b/imag-store/tests/002-retrieve_test.sh
@@ -18,9 +18,9 @@ retrieve() {
}
test_retrieve_nothing() {
- local id="test-retrieve_nothing~0.2.0"
+ local id="test-retrieve_nothing"
- imag-store create -p /${id} || { err "create failed"; return 1; }
+ imag-store create -p ${id} || { err "create failed"; return 1; }
out "Going to test the retrieve functionality now"
local zero_out="$(retrieve --id /${id})"
@@ -33,9 +33,9 @@ test_retrieve_nothing() {
}
test_retrieve_content() {
- local id="test-retrieve_simple~0.2.0"
+ local id="test-retrieve_simple"
- imag-store create -p /${id} || { err "create failed"; return 1; }
+ imag-store create -p ${id} || { err "create failed"; return 1; }
out "Going to test the retrieve functionality now"
@@ -49,12 +49,12 @@ test_retrieve_content() {
}
test_retrieve_header() {
- local id="test-retrieve_simple~0.2.0"
+ local id="test-retrieve_simple"
- imag-store create -p /${id} || { err "create failed"; return 1; }
+ imag-store create -p ${id} || { err "create failed"; return 1; }
out "Going to test the retrieve functionality now"
- local header_out="$(retrieve --id /${id} --header)"
+ local header_out="$(retrieve --id ${id} --header)"
out "Retrieving for header_out finished"
if [[ ! "$header_out" != "$(std_header)" ]]; then
@@ -64,12 +64,12 @@ test_retrieve_header() {
}
test_retrieve_raw() {
- local id="test-retrieve_simple~0.2.0"
+ local id="test-retrieve_simple"
- imag-store create -p /${id} || { err "create failed"; return 1; }
+ imag-store create -p ${id} || { err "create failed"; return 1; }
out "Going to test the retrieve functionality now"
- local both_out="$(retrieve --id /${id} --raw)"
+ local both_out="$(retrieve --id ${id} --raw)"
out "Retrieving for both_out finished"
if [[ "$both_out" != "$(std_header)" ]]; then
diff --git a/imag-store/tests/003-delete_test.sh b/imag-store/tests/003-delete_test.sh
index a0eb97a2..a3d890e5 100644
--- a/imag-store/tests/003-delete_test.sh
+++ b/imag-store/tests/003-delete_test.sh
@@ -12,10 +12,10 @@ delete() {
}
test_delete_simple() {
- local name="test~0.2.0"
+ local name="test"
- create -p /$name
- delete --id /$name
+ create -p $name
+ delete --id $name
local n=$($(find ${STORE}/ -type f | wc -l))
if [[ $n -eq 0 ]]; then
diff --git a/imag-tag/src/main.rs b/imag-tag/src/main.rs
index b01a74f0..f7c91dd0 100644
--- a/imag-tag/src/main.rs
+++ b/imag-tag/src/main.rs
@@ -10,14 +10,15 @@ extern crate libimagentrytag;
extern crate libimagerror;
use std::process::exit;
+use std::path::PathBuf;
use libimagrt::runtime::Runtime;
use libimagrt::setup::generate_runtime_setup;
use libimagentrytag::tagable::Tagable;
use libimagentrytag::tag::Tag;
-use libimagstore::storeid::build_entry_path;
use libimagerror::trace::{trace_error, trace_error_exit};
use libimagentrytag::ui::{get_add_tags, get_remove_tags};
+use libimagstore::storeid::StoreId;
mod ui;
@@ -34,11 +35,13 @@ fn main() {
.subcommand_name()
.map_or_else(
|| {
+ let id = PathBuf::from(id);
let add = get_add_tags(rt.cli());
let rem = get_remove_tags(rt.cli());
alter(&rt, id, add, rem);
},
|name| {
+ let id = PathBuf::from(id);
debug!("Call: {}", name);
match name {
"list" => list(id, &rt),
@@ -50,9 +53,9 @@ fn main() {
});
}
-fn alter(rt: &Runtime, id: &str, add: Option<Vec<Tag>>, rem: Option<Vec<Tag>>) {
+fn alter(rt: &Runtime, id: PathBuf, add: Option<Vec<Tag>>, rem: Option<Vec<Tag>>) {
let path = {
- match build_entry_path(rt.store(), id) {
+ match StoreId::new(Some(rt.store().path().clone()), id) {
Err(e) => trace_error_exit(&e, 1),
Ok(s) => s,
}
@@ -91,12 +94,10 @@ fn alter(rt: &Runtime, id: &str, add: Option<Vec<Tag>>, rem: Option<Vec<Tag>>) {
}
}
-fn list(id: &str, rt: &Runtime) {
- let path = {
- match build_entry_path(rt.store(), id) {
- Err(e) => trace_error_exit(&e, 1),
- Ok(s) => s,
- }
+fn list(id: PathBuf, rt: &Runtime) {
+ let path = match StoreId::new(Some(rt.store().path().clone()), id) {
+ Err(e) => trace_error_exit(&e, 1),
+ Ok(s) => s,
};
debug!("path = {:?}", path);
@@ -108,8 +109,7 @@ fn list(id: &str, rt: &Runtime) {
},
Err(e) => {
- debug!("Could