This commit is contained in:
2024-05-30 16:04:30 +02:00
parent 6f6c78d3ff
commit 56f659a182
15 changed files with 399 additions and 243 deletions

21
src/commands/list.rs Normal file
View File

@@ -0,0 +1,21 @@
use crate::{config, modrinth::project::get_multiple_projects};
use colored::*;
use comfy_table::{presets::NOTHING, Table};
pub async fn list() {
let config = config::Config::get().unwrap();
let projects = get_multiple_projects(config.projects.keys().to_owned().collect())
.await
.unwrap();
let rows: Vec<Vec<ColoredString>> = projects
.iter()
.map(|p| vec![p.title.bold(), p.id.dimmed()])
.collect();
let mut table = Table::new();
table.load_preset(NOTHING).add_rows(rows);
println!("{table}");
}