From 94ec8cfd7190e8c85ab9e49fe9878639086207c0 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Fri, 12 Sep 2025 09:29:50 -0500 Subject: [PATCH] Add and connect "list-packages" subcommand And with that I have the API call being made!... except it doesn't work quite right. --- src/cli.rs | 1 + src/main.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index c8fffe1..78e418c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -44,4 +44,5 @@ pub enum Commands { #[arg()] files: Vec, }, + ListPackages, } diff --git a/src/main.rs b/src/main.rs index 10e505e..d210b7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(())