mirror of
https://github.com/mii443/usls.git
synced 2025-08-22 15:45:41 +00:00
27 lines
880 B
Rust
27 lines
880 B
Rust
use usls::Hub;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
tracing_subscriber::fmt()
|
|
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
|
.with_timer(tracing_subscriber::fmt::time::ChronoLocal::rfc_3339())
|
|
.init();
|
|
|
|
// 1. Download from default github release
|
|
let path = Hub::default().try_fetch("images/bus.jpg")?;
|
|
println!("Fetch one image: {:?}", path);
|
|
|
|
// 2. Download from specific github release url
|
|
let path = Hub::default()
|
|
.try_fetch("https://github.com/jamjamjon/assets/releases/download/images/bus.jpg")?;
|
|
println!("Fetch one file: {:?}", path);
|
|
|
|
// 3. Fetch tags and files
|
|
let hub = Hub::default().with_owner("jamjamjon").with_repo("usls");
|
|
for tag in hub.tags().iter() {
|
|
let files = hub.files(tag);
|
|
println!("{} => {:?}", tag, files); // Should be empty
|
|
}
|
|
|
|
Ok(())
|
|
}
|