Files
packium/src/commands/list.rs

28 lines
667 B
Rust

use crate::{config, pack::Modpack};
use colored::*;
use comfy_table::{presets::NOTHING, Table};
pub async fn list() {
let config = config::Config::get().unwrap();
let modpack = Modpack::from_config(&config).await.unwrap();
let rows: Vec<Vec<ColoredString>> = modpack
.mods
.values()
.into_iter()
.map(|p| {
vec![
p.title.bold(),
p.project_id.dimmed(),
p.version.as_ref().unwrap().version_number.normal(),
]
})
.collect();
let mut table = Table::new();
table.load_preset(NOTHING).add_rows(rows);
println!("{table}");
}