summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormario-kr <mario-krehl@gmx.de>2018-01-02 12:48:32 +0100
committerGitHub <noreply@github.com>2018-01-02 12:48:32 +0100
commit6bb14df68bcb2f094d91f6740bee511e5055cc9b (patch)
tree2f8a0e9563660bf1781bcc7d8ac38b9343b8a2e5
parent6d0705ba3e1fdf72acf4c06cca9f3f45ab1164bf (diff)
parentcb1dffd2d42228ee282efc007a8a2401a27f1adb (diff)
Merge pull request #5 from mario-kr/file-alias
File alias
-rw-r--r--example_config.toml2
-rw-r--r--src/main.rs10
2 files changed, 6 insertions, 6 deletions
diff --git a/example_config.toml b/example_config.toml
index 01538c4..49abd75 100644
--- a/example_config.toml
+++ b/example_config.toml
@@ -1,5 +1,5 @@
# all three attributes are required for every item
-# use unique aliases; only use letters/number or - and _
+# file names are considered unique: so only 1 regex may be configured for a file
# do not use a dot in an alias
# only named captures will be used
# named capture need to match a numeric value (int or a float like 10.654321)
diff --git a/src/main.rs b/src/main.rs
index 43d9a48..ea2dee5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -105,8 +105,8 @@ fn hash_map_targets<'a>(c : &'a Config, targets : Vec<Target>)
for li in c.items() {
for t in targets.clone() {
if li.aliases().contains(&t.target) {
- if _res.contains_key(&li.alias()) {
- if let Some(&mut (_litem, ref mut cnames)) = _res.get_mut(&li.alias()) {
+ if _res.contains_key(&li.file()) {
+ if let Some(&mut (_litem, ref mut cnames)) = _res.get_mut(&li.file()) {
cnames.push((
cname_from_target(&t.target)?,
t.target.clone())
@@ -115,7 +115,7 @@ fn hash_map_targets<'a>(c : &'a Config, targets : Vec<Target>)
}
else {
_res.insert(
- li.alias(),
+ li.file(),
(
&li,
vec![(cname_from_target(&t.target)?, t.target.clone())]
@@ -143,7 +143,7 @@ fn hash_map_iter(h : HashMap<&String, (&LogItem, Vec<(String, String)>)>, d_from
-> Result<Vec<TargetData>> {
let mut _res = Vec::new();
- for (_alias, &(logitem, ref cns)) in h.iter() {
+ for (file, &(logitem, ref cns)) in h.iter() {
// prepare an empty Vector of Series
let mut series_vec = Vec::new();
@@ -153,7 +153,7 @@ fn hash_map_iter(h : HashMap<&String, (&LogItem, Vec<(String, String)>)>, d_from
// open the current file for reading
let mut line_iter = BufReader::new(
- File::open(logitem.file())
+ File::open(file)
.chain_err(|| format!("antikoerper log file could not be opened: {}", logitem.file()))?
).lines();