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:
@@ -44,4 +44,5 @@ pub enum Commands {
|
||||
#[arg()]
|
||||
files: Vec<String>,
|
||||
},
|
||||
ListPackages,
|
||||
}
|
||||
|
||||
10
src/main.rs
10
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(())
|
||||
|
||||
Reference in New Issue
Block a user