chore: update dependencies (#1103)

* update trivial dependencies

* switch to sha1_smol

* update async_zip

* fix cli

* clippy & fmt

* js lints

* fix build for ci
This commit is contained in:
ToBinio
2024-04-07 21:13:35 +02:00
committed by GitHub
parent 6699b4cb33
commit 3e7fd80824
57 changed files with 2720 additions and 2038 deletions

View File

@@ -1,13 +1,14 @@
//! Profile management subcommand
use crate::util::{
confirm_async, prompt_async, select_async, table, table_path_display,
};
use crate::util::table_path_display;
use crate::util::{confirm_async, prompt_async, select_async, table};
use daedalus::modded::LoaderVersion;
use dunce::canonicalize;
use eyre::{ensure, Result};
use futures::prelude::*;
use paris::*;
use std::path::{Path, PathBuf};
use tabled::settings::object::Columns;
use tabled::settings::{Modify, Width};
use tabled::Tabled;
use theseus::prelude::*;
use theseus::profile::create::profile_create;
@@ -216,12 +217,12 @@ pub struct ProfileList {}
#[derive(Tabled)]
struct ProfileRow<'a> {
name: &'a str,
#[field(display_with = "table_path_display")]
#[tabled(display_with = "table_path_display")]
path: &'a Path,
#[header("game version")]
#[tabled(rename = "game version")]
game_version: &'a str,
loader: &'a ModLoader,
#[header("loader version")]
#[tabled(rename = "loader version")]
loader_version: &'a str,
}
@@ -262,10 +263,9 @@ impl ProfileList {
let profiles = profile::list(None).await?;
let rows = profiles.values().map(ProfileRow::from);
let table = table(rows).with(
tabled::Modify::new(tabled::Column(1..=1))
.with(tabled::MaxWidth::wrapping(40)),
);
let mut table = table(rows);
table.with(Modify::new(Columns::new(1..=1)).with(Width::wrap(40)));
println!("{table}");
Ok(())

View File

@@ -1,6 +1,7 @@
use dialoguer::{Confirm, Input, Select};
use eyre::Result;
use std::{borrow::Cow, path::Path};
use tabled::settings::Style;
use tabled::{Table, Tabled};
// TODO: make primarily async to avoid copies
@@ -14,11 +15,10 @@ pub fn prompt(prompt: &str, default: Option<String>) -> Result<String> {
};
print_prompt(&prompt);
let mut input = Input::<String>::new();
input.with_prompt("").show_default(false);
let mut input = Input::<String>::new().with_prompt("").show_default(false);
if let Some(default) = default {
input.default(default);
input = input.default(default);
}
Ok(input.interact_text()?.trim().to_owned())
@@ -59,7 +59,7 @@ pub async fn confirm_async(prompt: String, default: bool) -> Result<bool> {
// Table helpers
pub fn table<T: Tabled>(rows: impl IntoIterator<Item = T>) -> Table {
Table::new(rows).with(tabled::Style::psql())
Table::new(rows).with(Style::psql()).clone()
}
pub fn table_path_display(path: &Path) -> String {