Add and connect "list-packages" subcommand

And with that I have the API call being made!... except it doesn't work
quite right.
This commit is contained in:
2025-09-12 09:29:50 -05:00
parent 55b992b5c4
commit 94ec8cfd71
2 changed files with 11 additions and 0 deletions

View File

@@ -44,4 +44,5 @@ pub enum Commands {
#[arg()]
files: Vec<String>,
},
ListPackages,
}

View File

@@ -134,6 +134,16 @@ async fn main() -> Result<(), gt_tool::Error> {
return Err(gt_tool::Error::NoSuchRelease);
}
}
gt_tool::cli::Commands::ListPackages => {
let packages = gt_tool::api::packages::list_packages(&client, &gitea_url, &owner, None).await?;
itertools::Itertools::intersperse(
packages
.iter()
.rev()
.map(|pkg| pkg.colorized()),
String::from("")
).for_each(|package| println!("{package}"));
}
}
Ok(())