Merge pull request #878 from matthiasbeyer/update-regex
Update regex to 0.2.*
This commit is contained in:
commit
3c7edcfb50
10 changed files with 28 additions and 17 deletions
|
@ -18,7 +18,7 @@ clap = ">=2.17"
|
||||||
filters = "0.1.*"
|
filters = "0.1.*"
|
||||||
itertools = "0.5"
|
itertools = "0.5"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
semver = "0.5.*"
|
semver = "0.5.*"
|
||||||
toml = "0.2.*"
|
toml = "0.2.*"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ homepage = "http://imag-pim.org"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = ">=2.17"
|
clap = ">=2.17"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
toml = "0.2.*"
|
toml = "0.2.*"
|
||||||
itertools = "0.5"
|
itertools = "0.5"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ clap = ">=2.17"
|
||||||
interactor = "0.1"
|
interactor = "0.1"
|
||||||
lazy_static = "0.2.*"
|
lazy_static = "0.2.*"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
toml = "0.2.1"
|
toml = "0.2.1"
|
||||||
spinner = "0.4"
|
spinner = "0.4"
|
||||||
rustyline = "1.0"
|
rustyline = "1.0"
|
||||||
|
|
|
@ -18,7 +18,7 @@ fs2 = "0.4"
|
||||||
glob = "0.2.11"
|
glob = "0.2.11"
|
||||||
lazy_static = "0.2.*"
|
lazy_static = "0.2.*"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
semver = "0.5"
|
semver = "0.5"
|
||||||
toml = "0.2.*"
|
toml = "0.2.*"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
|
|
|
@ -1182,13 +1182,13 @@ impl Entry {
|
||||||
Some(s) => s
|
Some(s) => s
|
||||||
};
|
};
|
||||||
|
|
||||||
let content = matches.name("content").unwrap_or("");
|
let content = matches.name("content").map(|r| r.as_str()).unwrap_or("");
|
||||||
|
|
||||||
debug!("Header and content found. Yay! Building Entry object now");
|
debug!("Header and content found. Yay! Building Entry object now");
|
||||||
Ok(Entry {
|
Ok(Entry {
|
||||||
location: try!(loc.into_storeid()),
|
location: try!(loc.into_storeid()),
|
||||||
header: try!(EntryHeader::parse(header)),
|
header: try!(EntryHeader::parse(header.as_str())),
|
||||||
content: content.into(),
|
content: String::from(content),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ clap = ">=2.17"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
chrono = "0.2"
|
chrono = "0.2"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
|
|
||||||
[dependencies.libimagerror]
|
[dependencies.libimagerror]
|
||||||
path = "../libimagerror"
|
path = "../libimagerror"
|
||||||
|
|
|
@ -73,9 +73,9 @@ impl Parse for Date {
|
||||||
|
|
||||||
R.captures(s)
|
R.captures(s)
|
||||||
.and_then(|capts| {
|
.and_then(|capts| {
|
||||||
let year = capts.name("Y").and_then(|o| FromStr::from_str(o).ok());
|
let year = capts.name("Y").and_then(|o| FromStr::from_str(o.as_str()).ok());
|
||||||
let month = capts.name("M").and_then(|o| FromStr::from_str(o).ok());
|
let month = capts.name("M").and_then(|o| FromStr::from_str(o.as_str()).ok());
|
||||||
let day = capts.name("D").and_then(|o| FromStr::from_str(o).ok());
|
let day = capts.name("D").and_then(|o| FromStr::from_str(o.as_str()).ok());
|
||||||
|
|
||||||
let year = match year {
|
let year = match year {
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -72,9 +72,18 @@ impl Parse for Time {
|
||||||
|
|
||||||
R.captures(s)
|
R.captures(s)
|
||||||
.and_then(|capts| {
|
.and_then(|capts| {
|
||||||
let minute = capts.name("m").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0);
|
let minute = capts
|
||||||
let second = capts.name("s").and_then(|o| FromStr::from_str(o).ok()).unwrap_or(0);
|
.name("m")
|
||||||
let hour = match capts.name("h").and_then(|o| FromStr::from_str(o).ok()) {
|
.and_then(|o| FromStr::from_str(o.as_str()).ok())
|
||||||
|
.unwrap_or(0);
|
||||||
|
let second = capts
|
||||||
|
.name("s")
|
||||||
|
.and_then(|o| FromStr::from_str(o.as_str()).ok())
|
||||||
|
.unwrap_or(0);
|
||||||
|
let hour = match capts
|
||||||
|
.name("h")
|
||||||
|
.and_then(|o| FromStr::from_str(o.as_str()).ok())
|
||||||
|
{
|
||||||
None => {
|
None => {
|
||||||
debug!("No hour");
|
debug!("No hour");
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -18,6 +18,6 @@ url = "1.2"
|
||||||
boolinator = "2.4.0"
|
boolinator = "2.4.0"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
tempfile = "2.1"
|
tempfile = "2.1"
|
||||||
|
|
||||||
|
|
|
@ -75,10 +75,12 @@ impl IntoKeyValue<String, String> for String {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
R.captures(&self[..])
|
R.captures(&self[..])
|
||||||
.map(|caps| caps.name("VALUE").or(caps.name("QVALUE")).unwrap_or(""))
|
.map(|c| c.name("VALUE").or(c.name("QVALUE")).map(|m| m.as_str()).unwrap_or(""))
|
||||||
};
|
};
|
||||||
|
|
||||||
key.and_then(|k| value.and_then(|v| Some(KeyValue::new(String::from(k), String::from(v)))))
|
key.and_then(|k| {
|
||||||
|
value.and_then(|v| Some(KeyValue::new(String::from(k.as_str()), String::from(v))))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue