Use a context struct

This commit is contained in:
Marc Plano-Lesay 2024-11-06 09:09:48 +11:00
parent 60208331ba
commit a0d9bfa97b
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
10 changed files with 134 additions and 45 deletions

View file

@ -1,6 +1,6 @@
use crate::{
context::Context,
utils::assets::{fetch_all_assets, AssetQuery},
Client,
};
use color_eyre::eyre::Result;
use tabled::{
@ -20,13 +20,13 @@ struct Asset {
model: String,
}
pub async fn list_assets(offline: bool, client: &Client) -> Result<()> {
pub async fn list_assets(ctx: Context, offline: bool) -> Result<()> {
let query = AssetQuery {
is_offline: if offline { Some(true) } else { None },
with_exif: true,
};
let mut assets: Vec<_> = fetch_all_assets(query, client)
let mut assets: Vec<_> = fetch_all_assets(query, &ctx.client)
.await?
.into_iter()
.map(|asset| Asset {