mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-23 07:41:03 +00:00
fix: Cargo doesn't respect the workspace profile settings (#2899)
This commit is contained in:
parent
1a6abae974
commit
f5d0f47b51
10 changed files with 53 additions and 74 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
|
@ -803,12 +803,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.12"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
|
||||
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1149,9 +1149,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "image-webp"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14d75c7014ddab93c232bc6bb9f64790d3dfd1d605199acd4b40b6d69e691e9f"
|
||||
checksum = "f6970fe7a5300b4b42e62c52efa0187540a5bef546c60edaf554ef595d2e6f0b"
|
||||
dependencies = [
|
||||
"byteorder-lite",
|
||||
"quick-error",
|
||||
|
|
@ -2122,9 +2122,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ravif"
|
||||
version = "0.11.12"
|
||||
version = "0.11.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6a5f31fcf7500f9401fea858ea4ab5525c99f2322cfcee732c0e6c74208c0c6"
|
||||
checksum = "5825c26fddd16ab9f515930d49028a630efec172e903483c94796cfe31893e6b"
|
||||
dependencies = [
|
||||
"avif-serialize",
|
||||
"imgref",
|
||||
|
|
@ -2496,9 +2496,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.103"
|
||||
version = "2.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -3092,9 +3092,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wide"
|
||||
version = "0.7.32"
|
||||
version = "0.7.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41b5576b9a81633f3e8df296ce0063042a73507636cbe956c61133dd7034ab22"
|
||||
checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"safe_arch",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use ratatui::layout::Rect;
|
|||
use tracing::warn;
|
||||
use yazi_shared::env_exists;
|
||||
|
||||
use crate::{Brand, Emulator, SHOWN, TMUX, WSL, drivers};
|
||||
use crate::{Emulator, SHOWN, TMUX, drivers};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub enum Adapter {
|
||||
|
|
@ -81,15 +81,7 @@ impl Adapter {
|
|||
|
||||
impl Adapter {
|
||||
pub fn matches(emulator: Emulator) -> Self {
|
||||
if emulator.kind.is_left_and(|&b| b == Brand::Microsoft) {
|
||||
return Self::Sixel;
|
||||
} else if WSL.get() && emulator.kind.is_left_and(|&b| b == Brand::WezTerm) {
|
||||
return Self::KgpOld;
|
||||
}
|
||||
|
||||
let mut protocols = emulator.adapters().to_owned();
|
||||
#[cfg(windows)]
|
||||
protocols.retain(|p| *p == Self::Iip);
|
||||
if env_exists("ZELLIJ_SESSION_NAME") {
|
||||
protocols.retain(|p| *p == Self::Sixel);
|
||||
} else if TMUX.get() {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,16 @@ description = "Yazi command-line interface"
|
|||
homepage = "https://yazi-rs.github.io"
|
||||
repository = "https://github.com/sxyazi/yazi"
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
panic = "abort"
|
||||
strip = true
|
||||
|
||||
[profile.release-windows]
|
||||
inherits = "release"
|
||||
panic = "unwind"
|
||||
|
||||
[dependencies]
|
||||
yazi-boot = { path = "../yazi-boot", version = "25.6.11" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "25.6.11" }
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ proc-macro = true
|
|||
|
||||
[dependencies]
|
||||
# External dependencies
|
||||
syn = { version = "2.0.103", features = [ "full" ] }
|
||||
syn = { version = "2.0.104", features = [ "full" ] }
|
||||
quote = "1.0.40"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use serde::Deserialize;
|
||||
use yazi_codegen::DeserializeOver1;
|
||||
use yazi_fs::{Xdg, ok_or_not_found};
|
||||
use yazi_shared::Layer;
|
||||
|
||||
use super::{Chord, KeymapRules};
|
||||
|
|
@ -36,6 +37,10 @@ impl Keymap {
|
|||
}
|
||||
|
||||
impl Keymap {
|
||||
pub(crate) fn read() -> Result<String> {
|
||||
Ok(ok_or_not_found(std::fs::read_to_string(Xdg::config_dir().join("keymap.toml")))?)
|
||||
}
|
||||
|
||||
pub(crate) fn reshape(self) -> Result<Self> {
|
||||
Ok(Self {
|
||||
mgr: self.mgr.reshape(Layer::Mgr)?,
|
||||
|
|
|
|||
|
|
@ -27,9 +27,8 @@ fn try_init(merge: bool) -> anyhow::Result<()> {
|
|||
let mut keymap = Preset::keymap()?;
|
||||
|
||||
if merge {
|
||||
let dir = yazi_fs::Xdg::config_dir();
|
||||
yazi = yazi.deserialize_over(toml::Deserializer::new(&migrate(dir.join("yazi.toml"))))?;
|
||||
keymap = keymap.deserialize_over(toml::Deserializer::new(&migrate(dir.join("keymap.toml"))))?;
|
||||
yazi = yazi.deserialize_over(toml::Deserializer::new(&yazi::Yazi::read()?))?;
|
||||
keymap = keymap.deserialize_over(toml::Deserializer::new(&keymap::Keymap::read()?))?;
|
||||
}
|
||||
|
||||
YAZI.init(yazi.reshape()?);
|
||||
|
|
@ -49,10 +48,7 @@ fn try_init_flavor(light: bool, merge: bool) -> anyhow::Result<()> {
|
|||
let mut theme = Preset::theme(light)?;
|
||||
|
||||
if merge {
|
||||
let shadow = theme::Theme::deserialize_shadow(toml::Deserializer::new(&migrate(
|
||||
yazi_fs::Xdg::config_dir().join("theme.toml"),
|
||||
)))?;
|
||||
|
||||
let shadow = theme::Theme::deserialize_shadow(toml::Deserializer::new(&theme::Theme::read()?))?;
|
||||
let flavor = shadow.flavor.as_ref().map(theme::Flavor::from).unwrap_or_default().read(light)?;
|
||||
theme = theme.deserialize_over(toml::Deserializer::new(&flavor))?;
|
||||
theme = theme.deserialize_over_with::<toml::Value>(shadow)?;
|
||||
|
|
@ -83,45 +79,3 @@ fn wait_for_key(e: anyhow::Error) -> anyhow::Result<()> {
|
|||
TTY.reader().read_exact(&mut [0])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// TODO: remove this in the future
|
||||
fn migrate(p: std::path::PathBuf) -> String {
|
||||
let Ok(old) = std::fs::read_to_string(&p) else {
|
||||
return String::new();
|
||||
};
|
||||
let Ok(mut doc) = old.parse::<toml_edit::DocumentMut>() else {
|
||||
return old;
|
||||
};
|
||||
if doc.get("mgr").is_some() {
|
||||
return old;
|
||||
}
|
||||
let Some(manager) = doc.remove("manager") else {
|
||||
return old;
|
||||
};
|
||||
|
||||
doc.insert("mgr", manager);
|
||||
let new = doc.to_string();
|
||||
|
||||
let mut backup = p.clone();
|
||||
backup.set_file_name(format!(
|
||||
"{}-{}",
|
||||
p.file_name().unwrap().to_str().unwrap(),
|
||||
yazi_shared::timestamp_us()
|
||||
));
|
||||
|
||||
if let Err(e) = std::fs::copy(&p, backup) {
|
||||
_ = TTY.writer().write_all(
|
||||
format!("WARNING: `[manager]` has been deprecated in favor of the new `[mgr]`, see #2803 for more details: https://github.com/sxyazi/yazi/pull/2803\r\n
|
||||
Trying to migrate your config automatically failed, please edit the file manually, error while backuping {p:?}: {e}\r\n").as_bytes(),
|
||||
);
|
||||
return new;
|
||||
}
|
||||
|
||||
if let Err(e) = std::fs::write(&p, &new) {
|
||||
_ = TTY.writer().write_all(
|
||||
format!("WARNING: `[manager]` has been deprecated in favor of the new `[mgr]`, see #2803 for more details: https://github.com/sxyazi/yazi/pull/2803\r\n
|
||||
Trying to migrate your config automatically failed, please edit the file manually, error while writing {p:?}: {e}\r\n").as_bytes(),
|
||||
);
|
||||
}
|
||||
new
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::path::PathBuf;
|
|||
use anyhow::{Result, bail};
|
||||
use serde::Deserialize;
|
||||
use yazi_codegen::{DeserializeOver1, DeserializeOver2};
|
||||
use yazi_fs::expand_path;
|
||||
use yazi_fs::{Xdg, expand_path, ok_or_not_found};
|
||||
|
||||
use super::{Filetype, Flavor, Icon};
|
||||
use crate::Style;
|
||||
|
|
@ -206,6 +206,10 @@ pub struct Help {
|
|||
}
|
||||
|
||||
impl Theme {
|
||||
pub(crate) fn read() -> Result<String> {
|
||||
Ok(ok_or_not_found(std::fs::read_to_string(Xdg::config_dir().join("theme.toml")))?)
|
||||
}
|
||||
|
||||
pub(crate) fn reshape(mut self, light: bool) -> Result<Self> {
|
||||
if self.which.cols < 1 || self.which.cols > 3 {
|
||||
bail!("[which].cols must be between 1 and 3");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use serde::Deserialize;
|
||||
use yazi_codegen::DeserializeOver1;
|
||||
use yazi_fs::{Xdg, ok_or_not_found};
|
||||
|
||||
use crate::{mgr, open, opener, plugin, popup, preview, tasks, which};
|
||||
|
||||
|
|
@ -19,6 +20,10 @@ pub struct Yazi {
|
|||
}
|
||||
|
||||
impl Yazi {
|
||||
pub(super) fn read() -> Result<String> {
|
||||
Ok(ok_or_not_found(std::fs::read_to_string(Xdg::config_dir().join("yazi.toml")))?)
|
||||
}
|
||||
|
||||
pub(super) fn reshape(self) -> Result<Self> {
|
||||
Ok(Self {
|
||||
mgr: self.mgr.reshape()?,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,16 @@ description = "Yazi File Manager"
|
|||
homepage = "https://yazi-rs.github.io"
|
||||
repository = "https://github.com/sxyazi/yazi"
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
panic = "abort"
|
||||
strip = true
|
||||
|
||||
[profile.release-windows]
|
||||
inherits = "release"
|
||||
panic = "unwind"
|
||||
|
||||
[features]
|
||||
default = [ "vendored-lua" ]
|
||||
vendored-lua = [ "mlua/vendored" ]
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ impl Hooks {
|
|||
}
|
||||
|
||||
// --- Hook
|
||||
// TODO: remove Send + Sync bounds when not needed
|
||||
pub(super) enum Hook {
|
||||
Sync(Box<dyn FnOnce(bool) + Send + Sync>),
|
||||
Async(Box<dyn (FnOnce(bool) -> BoxFuture<'static, ()>) + Send + Sync>),
|
||||
Sync(Box<dyn FnOnce(bool) + Send>),
|
||||
Async(Box<dyn (FnOnce(bool) -> BoxFuture<'static, ()>) + Send>),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue