feat: basics
This commit is contained in:
Generated
+1128
File diff suppressed because it is too large
Load Diff
@@ -4,3 +4,6 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
droplet-rs = { git = "https://github.com/Drop-OSS/droplet-rs.git", version = "0.11.1" }
|
||||
indicatif = "0.18.3"
|
||||
tokio = { version = "1.48.0", features = ["macros"] }
|
||||
|
||||
+39
-2
@@ -1,3 +1,40 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
use droplet_rs::manifest::generate_manifest_rusty;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use tokio::runtime::Handle;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let threads = Handle::current().metrics().num_workers();
|
||||
println!("using {} workers", threads);
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let path = &args[1];
|
||||
|
||||
let path = PathBuf::from(path);
|
||||
if !path.exists() {
|
||||
panic!("{} does not exist", path.display());
|
||||
}
|
||||
|
||||
println!("using path {}", path.display());
|
||||
|
||||
let progress_bar = ProgressBar::new(100_00).with_style(
|
||||
ProgressStyle::template(
|
||||
ProgressStyle::default_bar(),
|
||||
"[{elapsed_precise}] [ETA {eta}] {wide_bar} {percent_precise}%",
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
let manifest = generate_manifest_rusty(
|
||||
&path,
|
||||
|progress| {
|
||||
let progress_int = (progress * 100.0f32).round() as u64;
|
||||
progress_bar.set_position(progress_int);
|
||||
},
|
||||
|log| {
|
||||
progress_bar.println(log);
|
||||
},
|
||||
)
|
||||
.await
|
||||
.expect("failed to generate manifest");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user