Commit 7cc297e8 authored by Scott Abbey's avatar Scott Abbey

Add range parsing for major version wildcard

parent ceee996e
......@@ -99,3 +99,22 @@ pub struct Predicate {
patch: Option<u64>,
pre: Vec<Identifier>,
}
pub fn parse(range: &str) -> Result<VersionReq, String> {
// an empty range is a major version wildcard
// so is a lone * or x of either capitalization
if (range == "")
|| (range == "*")
|| (range == "x")
|| (range == "X") {
return Ok(VersionReq {
predicates: vec![Predicate {
op: Op::Wildcard(WildcardVersion::Major),
major: 0,
minor: None,
patch: None,
pre: Vec::new(),
}],
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment