mirror of
https://codeberg.org/spire/depot-prefetch.git
synced 2026-06-03 18:14:08 +02:00
add --dont-fetch
This commit is contained in:
parent
f9084b5298
commit
35a1f5085c
2 changed files with 20 additions and 9 deletions
|
|
@ -15,6 +15,9 @@ depots.
|
||||||
You can find depot id's for an app on
|
You can find depot id's for an app on
|
||||||
[steamdb](https://steamdb.info/app/232250/depots/).
|
[steamdb](https://steamdb.info/app/232250/depots/).
|
||||||
|
|
||||||
|
If you only care about knowing the latest manifest, you can pass `--dont-fetch`
|
||||||
|
to disable pre-fetching the manifest's data.
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|
|
||||||
26
src/main.rs
26
src/main.rs
|
|
@ -18,6 +18,8 @@ struct Args {
|
||||||
/// Only prefetch the listed depot(s)
|
/// Only prefetch the listed depot(s)
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
depot: Vec<u32>,
|
depot: Vec<u32>,
|
||||||
|
#[clap(long)]
|
||||||
|
dont_fetch: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|
@ -37,20 +39,26 @@ async fn main() -> MainResult {
|
||||||
manifest: manifest.gid,
|
manifest: manifest.gid,
|
||||||
});
|
});
|
||||||
|
|
||||||
let outputs = manifests.map(|input| {
|
if args.dont_fetch {
|
||||||
prefetch(&input).map(|hash| ManifestOutput {
|
let inputs = manifests.collect::<Vec<_>>();
|
||||||
app_id: input.app_id,
|
serde_json::to_writer_pretty(std::io::stdout(), &inputs)?;
|
||||||
depot_id: input.depot_id,
|
} else {
|
||||||
manifest: input.manifest,
|
let outputs = manifests.map(|input| {
|
||||||
hash,
|
prefetch(&input).map(|hash| ManifestOutput {
|
||||||
})
|
app_id: input.app_id,
|
||||||
}).collect::<Result<Vec<_>, _>>()?;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
struct ManifestInput {
|
struct ManifestInput {
|
||||||
app_id: u32,
|
app_id: u32,
|
||||||
depot_id: u32,
|
depot_id: u32,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue