use anyhow::Result;
use azure_devops_rust_api::git;
use std::env;
mod utils;
#[tokio::main]
async fn main() -> Result<()> {
let credential = utils::get_credential()?;
let organization = env::var("ADO_ORGANIZATION").expect("Must define ADO_ORGANIZATION");
let project = env::var("ADO_PROJECT").expect("Must define ADO_PROJECT");
let repository_name = env::args()
.nth(1)
.expect("Usage: git_items_list <repository-name>");
let git_client = git::ClientBuilder::new(credential).build();
let items = git_client
.items_client()
.list(organization, repository_name, project)
.recursion_level("Full")
.await?
.value;
for item in items.iter() {
if let Some(path) = &item.item_model.path {
println!("{path}");
}
}
println!("{} items found", items.len());
Ok(())
}