diff --git a/pack b/pack index 6ce8a8e..5614076 100755 Binary files a/pack and b/pack differ diff --git a/src/main.rs b/src/main.rs index f57136c..a1ac9c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,9 @@ use std::fs::File; use std::path::Path; use std::io::Read; +use std::result::Result; +use reqwest::IntoUrl; use reqwest::Client; use reqwest::header::ETAG; @@ -26,13 +28,21 @@ fn main() -> Result<(), std::io::Error> { std::process::exit(1); } - print!("Making request..."); - let mut resp = client.get(vec[0]) - .send().expect("Failed to make request"); - let full_path: Vec<&str> = vec[0].split("/").collect(); let pkgname = full_path[full_path.len() - 1]; + let repo = match vec[1] { + "arch" => "http://mirrors.advancedhosters.com/archlinux/core/os/x86_64/", + _ => { + println!("Repo {} is not supported...", vec[1]); + std::process::exit(0); + }, + }; + print!("Making request..."); + let url = reqwest::Url::parse(&(repo.to_string() + pkgname)).expect("Failed to parse URL"); + let mut resp = client.get(url) + .send().expect("Failed to make request"); + if resp.status().is_success() { println!("OK"); if let Some(etag) = resp.headers().get(ETAG) {