add --dont-fetch

This commit is contained in:
Robin Appelman 2025-06-21 00:07:46 +02:00
commit 35a1f5085c
2 changed files with 20 additions and 9 deletions

View file

@ -18,6 +18,8 @@ struct Args {
/// Only prefetch the listed depot(s)
#[clap(long)]
depot: Vec<u32>,
#[clap(long)]
dont_fetch: bool,
}
#[tokio::main]
@ -37,20 +39,26 @@ async fn main() -> MainResult {
manifest: manifest.gid,
});
let outputs = manifests.map(|input| {
prefetch(&input).map(|hash| ManifestOutput {
app_id: input.app_id,
depot_id: input.depot_id,
manifest: input.manifest,
hash,
})
}).collect::<Result<Vec<_>, _>>()?;
if args.dont_fetch {
let inputs = manifests.collect::<Vec<_>>();
serde_json::to_writer_pretty(std::io::stdout(), &inputs)?;
} else {
let outputs = manifests.map(|input| {
prefetch(&input).map(|hash| ManifestOutput {
app_id: input.app_id,
depot_id: input.depot_id,
manifest: input.manifest,
hash,
})
}).collect::<Result<Vec<_>, _>>()?;
serde_json::to_writer_pretty(std::io::stdout(), &outputs)?;
serde_json::to_writer_pretty(std::io::stdout(), &outputs)?;
}
Ok(())
}
#[derive(Debug, Serialize)]
struct ManifestInput {
app_id: u32,
depot_id: u32,