mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 14:51:03 +00:00
fix: decouple yazi_boot crate init from yazi_term init (#4011)
This commit is contained in:
parent
601cb10b32
commit
e892bf7d90
37 changed files with 285 additions and 259 deletions
6
.github/DISCUSSION_TEMPLATE/1-q-a.yml
vendored
6
.github/DISCUSSION_TEMPLATE/1-q-a.yml
vendored
|
|
@ -22,10 +22,10 @@ body:
|
|||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: debug
|
||||
id: env
|
||||
attributes:
|
||||
label: "`yazi --debug` output"
|
||||
description: Please run `yazi --debug` and paste the debug information here.
|
||||
label: "`ya env` output"
|
||||
description: Run `ya env` and paste the environment information here.
|
||||
render: Shell
|
||||
validations:
|
||||
required: true
|
||||
|
|
|
|||
8
.github/ISSUE_TEMPLATE/bug.yml
vendored
8
.github/ISSUE_TEMPLATE/bug.yml
vendored
|
|
@ -26,10 +26,10 @@ body:
|
|||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: debug
|
||||
id: env
|
||||
attributes:
|
||||
label: "`yazi --debug` output"
|
||||
description: Please run `yazi --debug` and paste the debug information here.
|
||||
label: "`ya env` output"
|
||||
description: Run `ya env` and paste the environment information here.
|
||||
render: Shell
|
||||
validations:
|
||||
required: true
|
||||
|
|
@ -65,6 +65,6 @@ body:
|
|||
options:
|
||||
- label: I tried the [latest nightly build](https://yazi-rs.github.io/docs/installation#binaries), and the issue is still reproducible
|
||||
required: true
|
||||
- label: I updated the debug information (`yazi --debug`) input box to the nightly that I tried
|
||||
- label: I updated the environment information (`ya env`) field to the nightly that I tried
|
||||
required: true
|
||||
- label: I can reproduce it after disabling all custom configs/plugins (`mv ~/.config/yazi ~/.config/yazi-backup`)
|
||||
|
|
|
|||
6
.github/ISSUE_TEMPLATE/feature.yml
vendored
6
.github/ISSUE_TEMPLATE/feature.yml
vendored
|
|
@ -4,10 +4,10 @@ labels: [feature]
|
|||
assignees: []
|
||||
body:
|
||||
- type: textarea
|
||||
id: debug
|
||||
id: env
|
||||
attributes:
|
||||
label: "`yazi --debug` output"
|
||||
description: Please run `yazi --debug` and paste the debug information here.
|
||||
label: "`ya env` output"
|
||||
description: Run `ya env` and paste the environment information here.
|
||||
render: Shell
|
||||
validations:
|
||||
required: true
|
||||
|
|
|
|||
91
Cargo.lock
generated
91
Cargo.lock
generated
|
|
@ -421,7 +421,7 @@ version = "0.10.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array 0.14.9",
|
||||
"generic-array 0.14.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -440,7 +440,7 @@ version = "0.3.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"
|
||||
dependencies = [
|
||||
"generic-array 0.14.9",
|
||||
"generic-array 0.14.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -557,9 +557,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.62"
|
||||
version = "1.2.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
|
||||
checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
|
|
@ -698,9 +698,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cmov"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746"
|
||||
checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
|
|
@ -908,11 +908,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
||||
dependencies = [
|
||||
"generic-array 0.14.9",
|
||||
"generic-array 0.14.7",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
|
|
@ -1196,7 +1196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.4",
|
||||
"crypto-common 0.1.6",
|
||||
"crypto-common 0.1.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1637,9 +1637,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.9"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
|
|
@ -1647,11 +1647,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "1.4.1"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dab9e9188e97a93276e1fe7b56401b851e2b45a46d045ca658100c1303ada649"
|
||||
checksum = "c2e55f16dcf0e9c00efbe2e655ffe45fc98e7066b52bc92f8a79e64060a79351"
|
||||
dependencies = [
|
||||
"generic-array 0.14.9",
|
||||
"generic-array 0.14.7",
|
||||
"rustversion",
|
||||
"typenum",
|
||||
]
|
||||
|
|
@ -1971,7 +1971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
||||
dependencies = [
|
||||
"block-padding 0.3.3",
|
||||
"generic-array 0.14.9",
|
||||
"generic-array 0.14.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2096,9 +2096,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "kqueue"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a"
|
||||
checksum = "273c0752728918e0ac4976f2b275b6fefb9ecd400585dec929419f3844cd87b5"
|
||||
dependencies = [
|
||||
"kqueue-sys",
|
||||
"libc",
|
||||
|
|
@ -2330,9 +2330,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
||||
checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
|
|
@ -3619,7 +3619,7 @@ dependencies = [
|
|||
"elliptic-curve",
|
||||
"enum_dispatch",
|
||||
"futures",
|
||||
"generic-array 1.4.1",
|
||||
"generic-array 1.4.3",
|
||||
"getrandom 0.2.17",
|
||||
"ghash",
|
||||
"hex-literal",
|
||||
|
|
@ -4018,9 +4018,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
|
|
@ -4126,9 +4126,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
|||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.3"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||
checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
|
|
@ -4750,9 +4750,9 @@ checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
|
|||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.20.0"
|
||||
version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
|
||||
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
|
|
@ -4836,9 +4836,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.23.1"
|
||||
version = "1.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
|
||||
checksum = "d258b83ceec21034727ecee8c382cfa6c3e133699b0742c64571814fb420c9f7"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"getrandom 0.4.2",
|
||||
|
|
@ -5730,16 +5730,11 @@ dependencies = [
|
|||
"clap_complete_nushell",
|
||||
"futures",
|
||||
"hashbrown 0.17.1",
|
||||
"regex",
|
||||
"vergen-gitcl",
|
||||
"yazi-adapter",
|
||||
"yazi-config",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-shim",
|
||||
"yazi-term",
|
||||
"yazi-version",
|
||||
"yazi-vfs",
|
||||
]
|
||||
|
||||
|
|
@ -5761,18 +5756,23 @@ dependencies = [
|
|||
"clap_complete_fig",
|
||||
"clap_complete_nushell",
|
||||
"hashbrown 0.17.1",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"toml",
|
||||
"twox-hash",
|
||||
"vergen-gitcl",
|
||||
"yazi-adapter",
|
||||
"yazi-boot",
|
||||
"yazi-config",
|
||||
"yazi-dds",
|
||||
"yazi-emulator",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-term",
|
||||
"yazi-tty",
|
||||
"yazi-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -5865,13 +5865,13 @@ dependencies = [
|
|||
"tokio-stream",
|
||||
"tracing",
|
||||
"uds_windows",
|
||||
"vergen-gitcl",
|
||||
"yazi-binding",
|
||||
"yazi-boot",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-shim",
|
||||
"yazi-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6086,13 +6086,13 @@ dependencies = [
|
|||
"tokio-util",
|
||||
"tracing",
|
||||
"yazi-binding",
|
||||
"yazi-boot",
|
||||
"yazi-config",
|
||||
"yazi-dds",
|
||||
"yazi-fs",
|
||||
"yazi-macro",
|
||||
"yazi-shared",
|
||||
"yazi-shim",
|
||||
"yazi-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6231,6 +6231,13 @@ dependencies = [
|
|||
"yazi-tty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yazi-version"
|
||||
version = "26.5.6"
|
||||
dependencies = [
|
||||
"vergen-gitcl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yazi-vfs"
|
||||
version = "26.5.6"
|
||||
|
|
@ -6299,18 +6306,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.49"
|
||||
version = "0.8.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bce33a6288fa3f072a8c2c7d0f2fdbb90e28298f0135c1f99b96c3db2efcc60b"
|
||||
checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.49"
|
||||
version = "0.8.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fd425244944f4ab65ccff928e7323354c5a018c75838362fdce749dfad2ee1e"
|
||||
checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function bugReportBody(creator, content, hash) {
|
|||
I noticed that you did not correctly follow the issue template. Please ensure that:
|
||||
|
||||
- The bug can still be reproduced on the [newest nightly build](https://yazi-rs.github.io/docs/installation/#binaries).
|
||||
- The debug information (\`yazi --debug\`) is updated for the newest nightly.
|
||||
- The environment info (\`ya env\`) is updated for the newest nightly.
|
||||
- The non-optional items in the checklist are checked.
|
||||
|
||||
Issues with \`${LABEL_NAME}\` will be marked ready once edited with the proper content, or closed after 2 days of inactivity.
|
||||
|
|
@ -32,7 +32,7 @@ function featureRequestBody(creator, content) {
|
|||
I noticed that you did not correctly follow the issue template. Please ensure that:
|
||||
|
||||
- The requested feature does not exist in the [newest nightly build](https://yazi-rs.github.io/docs/installation/#binaries).
|
||||
- The debug information (\`yazi --debug\`) is updated for the newest nightly.
|
||||
- The environment info (\`ya env\`) is updated for the newest nightly.
|
||||
- The non-optional items in the checklist are checked.
|
||||
|
||||
Issues with \`${LABEL_NAME}\` will be marked ready once edited with the proper content, or closed after 2 days of inactivity.
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ impl Tty {
|
|||
};
|
||||
|
||||
match result {
|
||||
Ok(()) => true.into_lua_multi(&lua),
|
||||
Err(e) => (false, Error::Io(e)).into_lua_multi(&lua),
|
||||
Ok(()) => true.into_lua_multi(lua),
|
||||
Err(e) => (false, Error::Io(e)).into_lua_multi(lua),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,21 +13,17 @@ rust-version.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.5.6" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.5.6" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.5.6" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.5.6" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
yazi-shim = { path = "../yazi-shim", version = "26.5.6" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.5.6" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.5.6" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.5.6" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
yazi-shim = { path = "../yazi-shim", version = "26.5.6" }
|
||||
yazi-version = { path = "../yazi-version", version = "26.5.6" }
|
||||
yazi-vfs = { path = "../yazi-vfs", version = "26.5.6" }
|
||||
|
||||
# External dependencies
|
||||
clap = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
hashbrown = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
|
|
@ -37,4 +33,3 @@ clap = { workspace = true }
|
|||
clap_complete = "4.6.5"
|
||||
clap_complete_fig = "4.5.2"
|
||||
clap_complete_nushell = "4.6.0"
|
||||
vergen-gitcl = { version = "9.1.0", features = [ "build", "rustc" ] }
|
||||
|
|
|
|||
|
|
@ -5,27 +5,8 @@ use std::{env, error::Error};
|
|||
|
||||
use clap::CommandFactory;
|
||||
use clap_complete::{Shell, generate_to};
|
||||
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder, RustcBuilder};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
Emitter::default()
|
||||
.add_instructions(&BuildBuilder::default().build_date(true).build()?)?
|
||||
.add_instructions(
|
||||
&RustcBuilder::default()
|
||||
.commit_date(true)
|
||||
.commit_hash(true)
|
||||
.host_triple(true)
|
||||
.semver(true)
|
||||
.build()?,
|
||||
)?
|
||||
.emit()?;
|
||||
|
||||
if env::var_os("YAZI_NO_GITCL").is_none() {
|
||||
Emitter::default().add_instructions(&GitclBuilder::default().sha(true).build()?)?.emit()?;
|
||||
} else {
|
||||
println!("cargo:rustc-env=VERGEN_GIT_SHA=no-gitcl");
|
||||
}
|
||||
|
||||
if env::var_os("YAZI_GEN_COMPLETIONS").is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@ pub struct Actions;
|
|||
impl Actions {
|
||||
pub(crate) fn act(args: &crate::Args) {
|
||||
if args.debug {
|
||||
println!("{}", Self::debug().unwrap());
|
||||
process::exit(0);
|
||||
}
|
||||
|
||||
if args.version {
|
||||
println!("Yazi {}", Self::version());
|
||||
println!("`yazi --debug` has been deprecated, use `ya env` instead.");
|
||||
process::exit(0);
|
||||
}
|
||||
|
||||
if args.clear_cache {
|
||||
Self::clear_cache();
|
||||
println!("`yazi --clear-cache` has been deprecated, use `ya cache clear` instead.");
|
||||
process::exit(0);
|
||||
}
|
||||
|
||||
if args.version {
|
||||
println!("Yazi\n{}", yazi_version::version_full());
|
||||
process::exit(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
yazi_macro::mod_flat!(actions clear_cache debug rustc triple version);
|
||||
yazi_macro::mod_flat!(actions);
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
use super::Actions;
|
||||
|
||||
impl Actions {
|
||||
pub(super) fn rustc() -> String {
|
||||
format!(
|
||||
"{} ({} {})",
|
||||
env!("VERGEN_RUSTC_SEMVER"),
|
||||
&env!("VERGEN_RUSTC_COMMIT_HASH")[..8],
|
||||
env!("VERGEN_RUSTC_COMMIT_DATE")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
use super::Actions;
|
||||
|
||||
impl Actions {
|
||||
pub(super) fn triple() -> String {
|
||||
format!(
|
||||
"{} ({}-{})",
|
||||
env!("VERGEN_RUSTC_HOST_TRIPLE"),
|
||||
std::env::consts::OS,
|
||||
std::env::consts::ARCH
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
use super::Actions;
|
||||
|
||||
impl Actions {
|
||||
pub fn version() -> &'static str {
|
||||
concat!(
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
" (",
|
||||
env!("VERGEN_GIT_SHA"),
|
||||
" ",
|
||||
env!("VERGEN_BUILD_DATE"),
|
||||
")"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -18,9 +18,9 @@ pub struct Args {
|
|||
#[arg(long)]
|
||||
pub chooser_file: Option<PathBuf>,
|
||||
|
||||
/// Clear the cache directory
|
||||
/// Clear the cache directory (deprecated, use `ya cache clear`)
|
||||
#[arg(long)]
|
||||
pub clear_cache: bool,
|
||||
pub clear_cache: bool, // TODO: remove
|
||||
|
||||
/// Use the specified client ID, must be a globally unique number
|
||||
#[arg(long)]
|
||||
|
|
@ -32,9 +32,9 @@ pub struct Args {
|
|||
#[arg(long)]
|
||||
pub remote_events: Option<String>,
|
||||
|
||||
/// Print debug information
|
||||
/// Print debug information (deprecated, use `ya env`)
|
||||
#[arg(long)]
|
||||
pub debug: bool,
|
||||
pub debug: bool, // TODO: remove
|
||||
|
||||
/// Print version
|
||||
#[arg(short = 'V', long)]
|
||||
|
|
|
|||
|
|
@ -13,17 +13,23 @@ rust-version.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.5.6" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.5.6" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.5.6" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.5.6" }
|
||||
yazi-adapter = { path = "../yazi-adapter", version = "26.5.6" }
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.5.6" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.5.6" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.5.6" }
|
||||
yazi-emulator = { path = "../yazi-emulator", version = "26.5.6" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.5.6" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
yazi-term = { path = "../yazi-term", version = "26.5.6" }
|
||||
yazi-tty = { path = "../yazi-tty", version = "26.5.6" }
|
||||
yazi-version = { path = "../yazi-version", version = "26.5.6" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
hashbrown = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
|
@ -41,7 +47,6 @@ clap_complete_fig = "4.5.2"
|
|||
clap_complete_nushell = "4.6.0"
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
vergen-gitcl = { version = "9.1.0", features = [ "build" ] }
|
||||
|
||||
[[bin]]
|
||||
name = "ya"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ use std::{env, error::Error};
|
|||
|
||||
use clap::CommandFactory;
|
||||
use clap_complete::{Shell, generate_to};
|
||||
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let manifest = env::var_os("CARGO_MANIFEST_DIR").unwrap().to_string_lossy().replace(r"\", "/");
|
||||
|
|
@ -21,16 +20,6 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
}
|
||||
|
||||
fn generate() -> Result<(), Box<dyn Error>> {
|
||||
Emitter::default()
|
||||
.add_instructions(&BuildBuilder::default().build_date(true).build()?)?
|
||||
.emit()?;
|
||||
|
||||
if env::var_os("YAZI_NO_GITCL").is_none() {
|
||||
Emitter::default().add_instructions(&GitclBuilder::default().sha(true).build()?)?.emit()?;
|
||||
} else {
|
||||
println!("cargo:rustc-env=VERGEN_GIT_SHA=no-gitcl");
|
||||
}
|
||||
|
||||
if env::var_os("YAZI_GEN_COMPLETIONS").is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ pub(super) enum Command {
|
|||
PubTo(CommandPubTo),
|
||||
/// Subscribe to messages from all remote instances.
|
||||
Sub(CommandSub),
|
||||
/// Manage the cache.
|
||||
#[command(subcommand)]
|
||||
Cache(CommandCache),
|
||||
/// Print environment and configuration information.
|
||||
Env,
|
||||
}
|
||||
|
||||
#[derive(clap::Args)]
|
||||
|
|
@ -154,6 +159,12 @@ pub(super) struct CommandSub {
|
|||
pub(super) kinds: String,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub(super) enum CommandCache {
|
||||
/// Clear the cache directory.
|
||||
Clear,
|
||||
}
|
||||
|
||||
// --- Macros
|
||||
macro_rules! impl_emit_body {
|
||||
($name:ident) => {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
use yazi_config::YAZI;
|
||||
use yazi_fs::Xdg;
|
||||
|
||||
use super::Actions;
|
||||
use crate::cache::Cache;
|
||||
|
||||
impl Actions {
|
||||
pub(super) fn clear_cache() {
|
||||
impl Cache {
|
||||
pub(crate) fn clear() -> anyhow::Result<()> {
|
||||
if YAZI.preview.cache_dir == *Xdg::temp_dir() {
|
||||
println!("Clearing cache directory: \n{:?}", YAZI.preview.cache_dir);
|
||||
std::fs::remove_dir_all(&YAZI.preview.cache_dir).unwrap();
|
||||
std::fs::remove_dir_all(&YAZI.preview.cache_dir)?;
|
||||
} else {
|
||||
println!(
|
||||
"You've changed the default cache directory, for your data's safety, please clear it manually: \n{:?}",
|
||||
YAZI.preview.cache_dir
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
3
yazi-cli/src/cache/mod.rs
vendored
Normal file
3
yazi-cli/src/cache/mod.rs
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
yazi_macro::mod_flat!(clear);
|
||||
|
||||
pub(crate) struct Cache;
|
||||
|
|
@ -44,10 +44,10 @@ impl Dds {
|
|||
}
|
||||
|
||||
pub(super) fn ensure_version(version: Option<&str>) -> Result<()> {
|
||||
if version != Some(EmberHi::version()) {
|
||||
if version != Some(yazi_version::version()) {
|
||||
bail!(
|
||||
"Incompatible version (Ya {}, Yazi {}). Restart all `ya` and `yazi` processes if you upgrade either one.",
|
||||
EmberHi::version(),
|
||||
"Incompatible version (Ya {}, Yazi {}). Restart all `ya` and `yazi` processes if you upgraded either.",
|
||||
yazi_version::version(),
|
||||
version.unwrap_or("Unknown")
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{env, ffi::OsStr, fmt::Write, path::Path};
|
||||
use std::{env, ffi::OsStr, fmt::Write, path::Path, process::Command};
|
||||
|
||||
use regex::Regex;
|
||||
use yazi_config::{THEME, YAZI};
|
||||
|
|
@ -7,22 +7,17 @@ use yazi_fs::Xdg;
|
|||
use yazi_shared::timestamp_us;
|
||||
use yazi_term::TERM;
|
||||
|
||||
use super::Actions;
|
||||
use crate::env::Env;
|
||||
|
||||
impl Actions {
|
||||
pub(super) fn debug() -> Result<String, std::fmt::Error> {
|
||||
impl Env {
|
||||
pub(crate) fn print() -> Result<String, std::fmt::Error> {
|
||||
let mut s = String::new();
|
||||
writeln!(s, "\nYazi")?;
|
||||
writeln!(s, " Version : {}", Self::version())?;
|
||||
writeln!(s, " Debug : {}", cfg!(debug_assertions))?;
|
||||
writeln!(s, " Triple : {}", Self::triple())?;
|
||||
writeln!(s, " Rustc : {}", Self::rustc())?;
|
||||
writeln!(s, "Yazi\n{}", Self::yazi_version())?;
|
||||
writeln!(s, " Backtrace: {:?}", env::var_os("RUST_BACKTRACE"))?;
|
||||
|
||||
writeln!(s, "\nYa")?;
|
||||
writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?;
|
||||
writeln!(s, "\nYa\n{}", yazi_version::version_full())?;
|
||||
|
||||
writeln!(s, "\nConfig")?;
|
||||
writeln!(s, "Config")?;
|
||||
writeln!(s, " Init : {}", Self::config_state("init.lua"))?;
|
||||
writeln!(s, " Yazi : {}", Self::config_state("yazi.toml"))?;
|
||||
writeln!(s, " Keymap : {}", Self::config_state("keymap.toml"))?;
|
||||
|
|
@ -88,47 +83,55 @@ impl Actions {
|
|||
|
||||
writeln!(s, "\nMultiplexers")?;
|
||||
writeln!(s, " TMUX : {}", yazi_emulator::TMUX)?;
|
||||
writeln!(s, " tmux version : {}", Self::process_output("tmux", "-V"))?;
|
||||
writeln!(s, " tmux version : {}", Self::dep_version("tmux", "-V"))?;
|
||||
writeln!(s, " tmux build flags : enable-sixel={}", Mux::tmux_sixel_flag())?;
|
||||
writeln!(s, " ZELLIJ_SESSION_NAME: {:?}", env::var_os("ZELLIJ_SESSION_NAME"))?;
|
||||
writeln!(s, " Zellij version : {}", Self::process_output("zellij", "--version"))?;
|
||||
writeln!(s, " Zellij version : {}", Self::dep_version("zellij", "--version"))?;
|
||||
|
||||
writeln!(s, "\nDependencies")?;
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " file : {}", Self::process_output(env::var_os("YAZI_FILE_ONE").unwrap_or("file".into()), "--version"))?;
|
||||
writeln!(s, " ueberzugpp : {}", Self::process_output("ueberzugpp", "--version"))?;
|
||||
writeln!(s, " file : {}", Self::dep_version(env::var_os("YAZI_FILE_ONE").unwrap_or("file".into()), "--version"))?;
|
||||
writeln!(s, " ueberzugpp : {}", Self::dep_version("ueberzugpp", "--version"))?;
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " ffmpeg/ffprobe: {} / {}", Self::process_output("ffmpeg", "-version"), Self::process_output("ffprobe", "-version"))?;
|
||||
writeln!(s, " pdftoppm : {}", Self::process_output("pdftoppm", "--help"))?;
|
||||
writeln!(s, " magick : {}", Self::process_output("magick", "--version"))?;
|
||||
writeln!(s, " fzf : {}", Self::process_output("fzf", "--version"))?;
|
||||
writeln!(s, " ffmpeg/ffprobe: {} / {}", Self::dep_version("ffmpeg", "-version"), Self::dep_version("ffprobe", "-version"))?;
|
||||
writeln!(s, " pdftoppm : {}", Self::dep_version("pdftoppm", "--help"))?;
|
||||
writeln!(s, " magick : {}", Self::dep_version("magick", "--version"))?;
|
||||
writeln!(s, " fzf : {}", Self::dep_version("fzf", "--version"))?;
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " fd/fdfind : {} / {}", Self::process_output("fd", "--version"), Self::process_output("fdfind", "--version"))?;
|
||||
writeln!(s, " rg : {}", Self::process_output("rg", "--version"))?;
|
||||
writeln!(s, " chafa : {}", Self::process_output("chafa", "--version"))?;
|
||||
writeln!(s, " zoxide : {}", Self::process_output("zoxide", "--version"))?;
|
||||
writeln!(s, " fd/fdfind : {} / {}", Self::dep_version("fd", "--version"), Self::dep_version("fdfind", "--version"))?;
|
||||
writeln!(s, " rg : {}", Self::dep_version("rg", "--version"))?;
|
||||
writeln!(s, " chafa : {}", Self::dep_version("chafa", "--version"))?;
|
||||
writeln!(s, " zoxide : {}", Self::dep_version("zoxide", "--version"))?;
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " 7zz/7z : {} / {}", Self::process_output("7zz", "i"), Self::process_output("7z", "i"))?;
|
||||
writeln!(s, " resvg : {}", Self::process_output("resvg", "--version"))?;
|
||||
writeln!(s, " jq : {}", Self::process_output("jq", "--version"))?;
|
||||
writeln!(s, " 7zz/7z : {} / {}", Self::dep_version("7zz", "i"), Self::dep_version("7z", "i"))?;
|
||||
writeln!(s, " resvg : {}", Self::dep_version("resvg", "--version"))?;
|
||||
writeln!(s, " jq : {}", Self::dep_version("jq", "--version"))?;
|
||||
|
||||
writeln!(s, "\nClipboard")?;
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " wl-copy/paste: {} / {}", Self::process_output("wl-copy", "--version"), Self::process_output("wl-paste", "--version"))?;
|
||||
writeln!(s, " xclip : {}", Self::process_output("xclip", "-version"))?;
|
||||
writeln!(s, " xsel : {}", Self::process_output("xsel", "--version"))?;
|
||||
writeln!(s, " wl-copy/paste: {} / {}", Self::dep_version("wl-copy", "--version"), Self::dep_version("wl-paste", "--version"))?;
|
||||
writeln!(s, " xclip : {}", Self::dep_version("xclip", "-version"))?;
|
||||
writeln!(s, " xsel : {}", Self::dep_version("xsel", "--version"))?;
|
||||
|
||||
writeln!(s, "\nRoutine")?;
|
||||
writeln!(s, " `file -bL --mime-type`: {}", Self::file1_output())?;
|
||||
|
||||
writeln!(
|
||||
s,
|
||||
"\n\nSee https://yazi-rs.github.io/docs/plugins/overview#debugging on how to enable logging or debug runtime errors."
|
||||
)?;
|
||||
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
fn yazi_version() -> String {
|
||||
match Command::new("yazi").arg("--version").output() {
|
||||
Ok(out) if out.status.success() => {
|
||||
let s = if out.stdout.is_empty() { out.stderr } else { out.stdout };
|
||||
let s = String::from_utf8_lossy(&s);
|
||||
let s = s.trim();
|
||||
s.strip_prefix("Yazi\n").unwrap_or(s).to_owned()
|
||||
}
|
||||
Ok(out) => format!("{:?}, {:?}", out.status, String::from_utf8_lossy(&out.stderr)),
|
||||
Err(e) => format!("{e}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn config_state(name: &str) -> String {
|
||||
let p = Xdg::config_dir().join(name);
|
||||
match std::fs::read_to_string(&p) {
|
||||
|
|
@ -139,8 +142,8 @@ impl Actions {
|
|||
}
|
||||
}
|
||||
|
||||
fn process_output(name: impl AsRef<OsStr>, arg: impl AsRef<OsStr>) -> String {
|
||||
match std::process::Command::new(&name).arg(arg).output() {
|
||||
fn dep_version(name: impl AsRef<OsStr>, arg: &str) -> String {
|
||||
match Command::new(&name).arg(arg).output() {
|
||||
Ok(out) if out.status.success() => {
|
||||
let line =
|
||||
String::from_utf8_lossy(&if out.stdout.is_empty() { out.stderr } else { out.stdout })
|
||||
|
|
@ -149,15 +152,12 @@ impl Actions {
|
|||
.next()
|
||||
.unwrap_or_default()
|
||||
.to_owned();
|
||||
if name.as_ref() == "ya" {
|
||||
line.trim_start_matches("Ya ").to_owned()
|
||||
} else {
|
||||
Regex::new(r"\d+\.\d+(\.\d+-\d+|\.\d+|\b)")
|
||||
.unwrap()
|
||||
.find(&line)
|
||||
.map(|m| m.as_str().to_owned())
|
||||
.unwrap_or(line)
|
||||
}
|
||||
|
||||
Regex::new(r"\d+\.\d+(\.\d+-\d+|\.\d+|\b)")
|
||||
.unwrap()
|
||||
.find(&line)
|
||||
.map(|m| m.as_str().to_owned())
|
||||
.unwrap_or(line)
|
||||
}
|
||||
Ok(out) => format!("{:?}, {:?}", out.status, String::from_utf8_lossy(&out.stderr)),
|
||||
Err(e) => format!("{e}"),
|
||||
|
|
@ -171,7 +171,7 @@ impl Actions {
|
|||
std::fs::File::create_new(&p).map(|mut f| f.write_all(b"Hello, World!")).ok();
|
||||
|
||||
let program = env::var_os("YAZI_FILE_ONE").unwrap_or("file".into());
|
||||
match std::process::Command::new(program).args(["-bL", "--mime-type"]).arg(&p).output() {
|
||||
match Command::new(program).args(["-bL", "--mime-type"]).arg(&p).output() {
|
||||
Ok(out) => {
|
||||
String::from_utf8_lossy(&out.stdout).trim().lines().next().unwrap_or_default().to_owned()
|
||||
}
|
||||
3
yazi-cli/src/env/mod.rs
vendored
Normal file
3
yazi-cli/src/env/mod.rs
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
yazi_macro::mod_flat!(env);
|
||||
|
||||
pub(crate) struct Env;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
yazi_macro::mod_pub!(dds package shared);
|
||||
yazi_macro::mod_pub!(cache dds env package shared);
|
||||
|
||||
yazi_macro::mod_flat!(args);
|
||||
|
||||
|
|
@ -31,12 +31,7 @@ async fn main() -> ExitCode {
|
|||
|
||||
async fn run() -> anyhow::Result<()> {
|
||||
if std::env::args_os().nth(1).is_some_and(|s| s == "-V" || s == "--version") {
|
||||
outln!(
|
||||
"Ya {} ({} {})",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
env!("VERGEN_GIT_SHA"),
|
||||
env!("VERGEN_BUILD_DATE")
|
||||
)?;
|
||||
outln!("Ya\n{}", yazi_version::version_full())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
@ -110,6 +105,25 @@ async fn run() -> anyhow::Result<()> {
|
|||
|
||||
tokio::signal::ctrl_c().await?;
|
||||
}
|
||||
|
||||
Command::Cache(cmd) => {
|
||||
yazi_tty::init();
|
||||
yazi_config::init()?;
|
||||
|
||||
match cmd {
|
||||
CommandCache::Clear => {
|
||||
cache::Cache::clear()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Command::Env => {
|
||||
yazi_tty::init();
|
||||
yazi_term::init()?;
|
||||
yazi_config::init()?;
|
||||
yazi_adapter::init()?;
|
||||
outln!("{}", env::Env::print()?)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ yazi-fs = { path = "../yazi-fs", version = "26.5.6" }
|
|||
yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
yazi-shim = { path = "../yazi-shim", version = "26.5.6" }
|
||||
yazi-version = { path = "../yazi-version", version = "26.5.6" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
|
|
@ -38,8 +39,5 @@ tokio = { workspace = true }
|
|||
tokio-stream = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
vergen-gitcl = { version = "9.1.0", features = [ "build" ] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
uds_windows = "1.2.1"
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
use std::{env, error::Error};
|
||||
|
||||
use vergen_gitcl::{Emitter, GitclBuilder};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
if env::var_os("YAZI_NO_GITCL").is_none() {
|
||||
Emitter::default().add_instructions(&GitclBuilder::default().sha(true).build()?)?.emit()?;
|
||||
} else {
|
||||
println!("cargo:rustc-env=VERGEN_GIT_SHA=no-gitcl");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ use mlua::{IntoLua, Lua, Value};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use yazi_shared::{Id, SStr};
|
||||
|
||||
use super::{Ember, EmberHi};
|
||||
use super::Ember;
|
||||
use crate::Peer;
|
||||
|
||||
/// Server handshake
|
||||
|
|
@ -15,7 +15,7 @@ pub struct EmberHey {
|
|||
|
||||
impl EmberHey {
|
||||
pub fn owned(peers: HashMap<Id, Peer>) -> Ember<'static> {
|
||||
Self { peers, version: EmberHi::version().into() }.into()
|
||||
Self { peers, version: yazi_version::version().into() }.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,10 @@ impl<'a> EmberHi<'a> {
|
|||
{
|
||||
Self {
|
||||
abilities: abilities.into_iter().map(Into::into).collect(),
|
||||
version: Self::version().into(),
|
||||
version: yazi_version::version().into(),
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
pub fn version() -> &'static str {
|
||||
concat!(env!("CARGO_PKG_VERSION"), " ", env!("VERGEN_GIT_SHA"))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<EmberHi<'a>> for Ember<'a> {
|
||||
|
|
|
|||
|
|
@ -14,20 +14,20 @@ async fn main() -> anyhow::Result<()> {
|
|||
Logs::start()?;
|
||||
_ = fdlimit::raise_fd_limit();
|
||||
|
||||
yazi_tty::init();
|
||||
|
||||
yazi_term::init()?;
|
||||
|
||||
yazi_fs::init();
|
||||
|
||||
yazi_config::init()?;
|
||||
|
||||
yazi_vfs::init();
|
||||
|
||||
yazi_adapter::init()?;
|
||||
yazi_tty::init();
|
||||
|
||||
yazi_config::init()?;
|
||||
|
||||
yazi_boot::init();
|
||||
|
||||
yazi_term::init()?;
|
||||
|
||||
yazi_adapter::init()?;
|
||||
|
||||
yazi_dds::init();
|
||||
|
||||
yazi_widgets::init();
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ vendored-lua = [ "mlua/vendored" ]
|
|||
|
||||
[dependencies]
|
||||
yazi-binding = { path = "../yazi-binding", version = "26.5.6" }
|
||||
yazi-boot = { path = "../yazi-boot", version = "26.5.6" }
|
||||
yazi-config = { path = "../yazi-config", version = "26.5.6" }
|
||||
yazi-dds = { path = "../yazi-dds", version = "26.5.6" }
|
||||
yazi-fs = { path = "../yazi-fs", version = "26.5.6" }
|
||||
yazi-macro = { path = "../yazi-macro", version = "26.5.6" }
|
||||
yazi-shared = { path = "../yazi-shared", version = "26.5.6" }
|
||||
yazi-shim = { path = "../yazi-shim", version = "26.5.6" }
|
||||
yazi-version = { path = "../yazi-version", version = "26.5.6" }
|
||||
|
||||
# External dependencies
|
||||
anyhow = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub struct Chunk {
|
|||
|
||||
impl Chunk {
|
||||
pub fn compatible(&self) -> bool {
|
||||
let s = yazi_boot::actions::Actions::version();
|
||||
let s = yazi_version::version();
|
||||
natsort(s.as_bytes(), self.since.as_bytes(), false) != std::cmp::Ordering::Less
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ impl Loader {
|
|||
bail!(
|
||||
"Plugin `{id}` requires at least Yazi {}, but your current version is Yazi {}.",
|
||||
chunk.since,
|
||||
yazi_boot::actions::Actions::version()
|
||||
yazi_version::version_long()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ impl fmt::Display for ByteString {
|
|||
|
||||
impl FromLua for ByteString {
|
||||
fn from_lua(value: Value, lua: &Lua) -> mlua::Result<Self> {
|
||||
Ok(ByteString(mlua::String::from_lua(value, lua)?))
|
||||
Ok(Self(mlua::String::from_lua(value, lua)?))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,16 +104,16 @@ pub enum KeyCode {
|
|||
impl KeyCode {
|
||||
pub(crate) fn from_xterm_modifier(r#final: u8) -> Result<Self> {
|
||||
Ok(match r#final {
|
||||
b'A' => KeyCode::Up,
|
||||
b'B' => KeyCode::Down,
|
||||
b'C' => KeyCode::Right,
|
||||
b'D' => KeyCode::Left,
|
||||
b'F' => KeyCode::End,
|
||||
b'H' => KeyCode::Home,
|
||||
b'P' => KeyCode::Fn(1),
|
||||
b'Q' => KeyCode::Fn(2),
|
||||
b'R' => KeyCode::Fn(3),
|
||||
b'S' => KeyCode::Fn(4),
|
||||
b'A' => Self::Up,
|
||||
b'B' => Self::Down,
|
||||
b'C' => Self::Right,
|
||||
b'D' => Self::Left,
|
||||
b'F' => Self::End,
|
||||
b'H' => Self::Home,
|
||||
b'P' => Self::Fn(1),
|
||||
b'Q' => Self::Fn(2),
|
||||
b'R' => Self::Fn(3),
|
||||
b'S' => Self::Fn(4),
|
||||
_ => bail!(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
16
yazi-version/Cargo.toml
Normal file
16
yazi-version/Cargo.toml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "yazi-version"
|
||||
description = "Yazi version information"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
vergen-gitcl = { version = "9.1.0", features = [ "build", "rustc" ] }
|
||||
5
yazi-version/README.md
Normal file
5
yazi-version/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# yazi-version
|
||||
|
||||
This crate is part of [Yazi][source], and it is not supposed to be used outside, as there are no guarantees about the stability of its API.
|
||||
|
||||
[source]: https://github.com/sxyazi/yazi
|
||||
25
yazi-version/build.rs
Normal file
25
yazi-version/build.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use std::{env, error::Error};
|
||||
|
||||
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder, RustcBuilder};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
Emitter::default()
|
||||
.add_instructions(&BuildBuilder::default().build_date(true).build()?)?
|
||||
.add_instructions(
|
||||
&RustcBuilder::default()
|
||||
.commit_date(true)
|
||||
.commit_hash(true)
|
||||
.host_triple(true)
|
||||
.semver(true)
|
||||
.build()?,
|
||||
)?
|
||||
.emit()?;
|
||||
|
||||
if env::var_os("YAZI_NO_GITCL").is_none() {
|
||||
Emitter::default().add_instructions(&GitclBuilder::default().sha(true).build()?)?.emit()?;
|
||||
} else {
|
||||
println!("cargo:rustc-env=VERGEN_GIT_SHA=no-gitcl");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
27
yazi-version/src/lib.rs
Normal file
27
yazi-version/src/lib.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use std::{env::consts::{ARCH, OS}, fmt::Write};
|
||||
|
||||
pub fn version() -> &'static str { concat!(env!("CARGO_PKG_VERSION"), " ", env!("VERGEN_GIT_SHA")) }
|
||||
|
||||
pub fn version_long() -> &'static str {
|
||||
concat!(
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
" (",
|
||||
env!("VERGEN_GIT_SHA"),
|
||||
" ",
|
||||
env!("VERGEN_BUILD_DATE"),
|
||||
")"
|
||||
)
|
||||
}
|
||||
|
||||
pub fn version_full() -> String {
|
||||
let mut s = String::new();
|
||||
|
||||
writeln!(s, " Version: {}", version_long()).ok();
|
||||
writeln!(s, " Debug : {}", cfg!(debug_assertions)).ok();
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " Triple : {} ({OS}-{ARCH})", env!("VERGEN_RUSTC_HOST_TRIPLE")).ok();
|
||||
#[rustfmt::skip]
|
||||
writeln!(s, " Rustc : {} ({} {})", env!("VERGEN_RUSTC_SEMVER"), &env!("VERGEN_RUSTC_COMMIT_HASH")[..8], env!("VERGEN_RUSTC_COMMIT_DATE")).ok();
|
||||
|
||||
s
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue