use crate::Result;
use crate::errors::Error;
use crate::paths::Paths;
use crate::version::Version;
pub fn run_release(paths: &Paths, version: &Version) -> Result<()> {
if version.is_distributed_via_server_packages_repository() {
return Err(Error::ExpectedNonAlphaVersion(version.clone()));
}
run(paths, version)
}
pub fn run_alpha(paths: &Paths, version: &Version) -> Result<()> {
if !version.is_distributed_via_server_packages_repository() {
return Err(Error::ExpectedAlphaVersion(version.clone()));
}
run(paths, version)
}
fn run(paths: &Paths, version: &Version) -> Result<()> {
if !paths.version_installed(version) {
return Err(Error::VersionNotInstalled(version.clone()));
}
println!("{}", paths.version_dir(version).display());
Ok(())
}