Rewrite
This commit is contained in:
21
src/commands/list.rs
Normal file
21
src/commands/list.rs
Normal 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}");
|
||||
}
|
Reference in New Issue
Block a user