install: support vX.Y.Z in addition to X.Y.Z (#8297)

automerge
This commit is contained in:
Michael Vines
2020-02-14 20:35:40 -07:00
committed by GitHub
parent 1bf2285fa2
commit 335675c51c
5 changed files with 51 additions and 40 deletions

View File

@ -86,20 +86,6 @@ pub fn is_url(string: String) -> Result<(), String> {
}
}
pub fn is_semver(semver: &str) -> Result<(), String> {
match semver::Version::parse(&semver) {
Ok(_) => Ok(()),
Err(err) => Err(format!("{:?}", err)),
}
}
pub fn is_release_channel(channel: &str) -> Result<(), String> {
match channel {
"edge" | "beta" | "stable" => Ok(()),
_ => Err(format!("Invalid release channel {}", channel)),
}
}
pub fn is_port(port: String) -> Result<(), String> {
port.parse::<u16>()
.map(|_| ())