Skip to content

Commit fd8871d

Browse files
realcathodesxyazi
andcommitted
feat: add additional environment and dependency info in yazi --debug (sxyazi#1896)
Co-authored-by: sxyazi <[email protected]>
1 parent a9a8a19 commit fd8871d

File tree

10 files changed

+96
-35
lines changed

10 files changed

+96
-35
lines changed

Cargo.lock

Lines changed: 32 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ futures = "0.3.31"
2121
globset = "0.4.15"
2222
libc = "0.2.162"
2323
md-5 = "0.10.6"
24-
mlua = { git = "https://github.com/mlua-rs/mlua.git", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
24+
mlua = { version = "0.10.1", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
2525
parking_lot = "0.12.3"
2626
ratatui = { version = "0.29.0", features = [ "unstable-rendered-line-info" ] }
2727
regex = "1.11.1"

cspell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","imagesize","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","hardlink","hardlinking","nlink","nlink","linemodes","SIGSTOP","sevenzip","rsplitn","replacen","DECSET","DECRQM","repeek","cwds","tcsi","Hyprland","Wayfire","SWAYSOCK","btime","nsec","codegen","gethostname","fchmod","fdfind"],"version":"0.2","language":"en","flagWords":[]}
1+
{"flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi","rsplit","ZELLIJ","bitflags","bitflags","USERPROFILE","Neovim","vergen","gitcl","Renderable","preloaders","prec","imagesize","Upserting","prio","Ghostty","Catmull","Lanczos","cmds","unyank","scrolloff","headsup","unsub","uzers","scopeguard","SPDLOG","globset","filetime","magick","magick","prefetcher","Prework","prefetchers","PREWORKERS","conds","translit","rxvt","Urxvt","realpath","realname","REPARSE","hardlink","hardlinking","nlink","nlink","linemodes","SIGSTOP","sevenzip","rsplitn","replacen","DECSET","DECRQM","repeek","cwds","tcsi","Hyprland","Wayfire","SWAYSOCK","btime","nsec","codegen","gethostname","fchmod","fdfind","Rustc","rustc","Sysinfo"],"language":"en","version":"0.2"}

nix/yazi-unwrapped.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ rustPlatform.buildRustPackage rec {
2929

3030
cargoLock = {
3131
lockFile = "${src}/Cargo.lock";
32-
outputHashes = {
33-
"mlua-0.10.0" = "sha256-Xg6/jc+UP8tbJJ6x1sbAgt8ZHt051xEBBcjmikQqYlw=";
34-
};
32+
#outputHashes = {
33+
# "mlua-0.10.0" = "sha256-Xg6/jc+UP8tbJJ6x1sbAgt8ZHt051xEBBcjmikQqYlw=";
34+
#};
3535
};
3636

3737
env = {

yazi-boot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ clap = { workspace = true }
2424
clap_complete = "4.5.37"
2525
clap_complete_fig = "4.5.2"
2626
clap_complete_nushell = "4.5.4"
27-
vergen-gitcl = { version = "1.0.1", features = [ "build" ] }
27+
vergen-gitcl = { version = "1.0.1", features = [ "build", "rustc" ] }

yazi-boot/build.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ use std::{env, error::Error};
55

66
use clap::CommandFactory;
77
use clap_complete::{Shell, generate_to};
8-
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};
8+
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder, RustcBuilder};
99

1010
fn main() -> Result<(), Box<dyn Error>> {
1111
Emitter::default()
1212
.add_instructions(&BuildBuilder::default().build_date(true).build()?)?
13+
.add_instructions(
14+
&RustcBuilder::default()
15+
.commit_date(true)
16+
.commit_hash(true)
17+
.host_triple(true)
18+
.semver(true)
19+
.build()?,
20+
)?
1321
.add_instructions(&GitclBuilder::default().commit_date(true).sha(true).build()?)?
1422
.emit()?;
1523

yazi-boot/src/actions/debug.rs

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ use super::Actions;
88

99
impl Actions {
1010
pub(super) fn debug() -> Result<String, std::fmt::Error> {
11-
use std::env::consts::{ARCH, FAMILY, OS};
1211
let mut s = String::new();
13-
1412
writeln!(s, "\nYazi")?;
1513
writeln!(s, " Version: {}", Self::version())?;
1614
writeln!(s, " Debug : {}", cfg!(debug_assertions))?;
17-
writeln!(s, " OS : {}-{} ({})", OS, ARCH, FAMILY)?;
15+
writeln!(s, " Triple : {}", Self::triple())?;
16+
writeln!(s, " Rustc : {}", Self::rustc())?;
1817

1918
writeln!(s, "\nYa")?;
2019
writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?;
@@ -43,11 +42,13 @@ impl Actions {
4342
writeln!(s, " WSL: {:?}", *yazi_adapter::WSL)?;
4443

4544
writeln!(s, "\nVariables")?;
46-
writeln!(s, " SHELL : {:?}", env::var_os("SHELL"))?;
47-
writeln!(s, " EDITOR : {:?}", env::var_os("EDITOR"))?;
48-
writeln!(s, " VISUAL : {:?}", env::var_os("VISUAL"))?;
49-
writeln!(s, " YAZI_FILE_ONE : {:?}", env::var_os("YAZI_FILE_ONE"))?;
50-
writeln!(s, " YAZI_CONFIG_HOME : {:?}", env::var_os("YAZI_CONFIG_HOME"))?;
45+
writeln!(s, " SHELL : {:?}", env::var_os("SHELL"))?;
46+
writeln!(s, " EDITOR : {:?}", env::var_os("EDITOR"))?;
47+
writeln!(s, " VISUAL : {:?}", env::var_os("VISUAL"))?;
48+
writeln!(s, " YAZI_FILE_ONE : {:?}", env::var_os("YAZI_FILE_ONE"))?;
49+
writeln!(s, " YAZI_CONFIG_HOME: {:?}", env::var_os("YAZI_CONFIG_HOME"))?;
50+
writeln!(s, " YAZI_ZOXIDE_OPTS: {:?}", env::var_os("YAZI_ZOXIDE_OPTS"))?;
51+
writeln!(s, " FZF_DEFAULT_OPTS: {:?}", env::var_os("FZF_DEFAULT_OPTS"))?;
5152

5253
writeln!(s, "\nText Opener")?;
5354
writeln!(
@@ -74,13 +75,11 @@ impl Actions {
7475
writeln!(s, " Zellij version : {}", Self::process_output("zellij", "--version"))?;
7576

7677
writeln!(s, "\nDependencies")?;
77-
writeln!(
78-
s,
79-
" file : {}",
80-
Self::process_output(env::var_os("YAZI_FILE_ONE").unwrap_or("file".into()), "--version")
81-
)?;
78+
#[rustfmt::skip]
79+
writeln!(s, " file : {}", Self::process_output(env::var_os("YAZI_FILE_ONE").unwrap_or("file".into()), "--version"))?;
8280
writeln!(s, " ueberzugpp : {}", Self::process_output("ueberzugpp", "--version"))?;
8381
writeln!(s, " ffmpegthumbnailer: {}", Self::process_output("ffmpegthumbnailer", "-v"))?;
82+
writeln!(s, " pdftoppm : {}", Self::process_output("pdftoppm", "--help"))?;
8483
writeln!(s, " magick : {}", Self::process_output("magick", "--version"))?;
8584
writeln!(s, " fzf : {}", Self::process_output("fzf", "--version"))?;
8685
writeln!(s, " fd : {}", Self::process_output("fd", "--version"))?;
@@ -92,6 +91,12 @@ impl Actions {
9291
writeln!(s, " 7zz : {}", Self::process_output("7zz", "i"))?;
9392
writeln!(s, " jq : {}", Self::process_output("jq", "--version"))?;
9493

94+
writeln!(s, "\nClipboard")?;
95+
#[rustfmt::skip]
96+
writeln!(s, " wl-copy/paste: {} / {}", Self::process_output("wl-copy", "--version"), Self::process_output("wl-paste", "--version"))?;
97+
writeln!(s, " xclip : {}", Self::process_output("xclip", "-version"))?;
98+
writeln!(s, " xsel : {}", Self::process_output("xsel", "--version"))?;
99+
95100
writeln!(s, "\n\n--------------------------------------------------")?;
96101
writeln!(
97102
s,
@@ -106,7 +111,12 @@ impl Actions {
106111
match std::process::Command::new(&name).arg(arg).output() {
107112
Ok(out) if out.status.success() => {
108113
let line =
109-
String::from_utf8_lossy(&out.stdout).trim().lines().next().unwrap_or_default().to_owned();
114+
String::from_utf8_lossy(&if out.stdout.is_empty() { out.stderr } else { out.stdout })
115+
.trim()
116+
.lines()
117+
.next()
118+
.unwrap_or_default()
119+
.to_owned();
110120
if name.as_ref() == "ya" {
111121
line.trim_start_matches("Ya ").to_owned()
112122
} else {

yazi-boot/src/actions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#![allow(clippy::module_inception)]
22

3-
yazi_macro::mod_flat!(actions clear_cache debug version);
3+
yazi_macro::mod_flat!(actions clear_cache debug rustc triple version);

yazi-boot/src/actions/rustc.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use super::Actions;
2+
3+
impl Actions {
4+
pub(super) fn rustc() -> String {
5+
format!(
6+
"{} ({} {})",
7+
env!("VERGEN_RUSTC_SEMVER"),
8+
&env!("VERGEN_RUSTC_COMMIT_HASH")[..8],
9+
env!("VERGEN_RUSTC_COMMIT_DATE")
10+
)
11+
}
12+
}

yazi-boot/src/actions/triple.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use super::Actions;
2+
3+
impl Actions {
4+
pub(super) fn triple() -> String {
5+
format!(
6+
"{} ({}-{})",
7+
env!("VERGEN_RUSTC_HOST_TRIPLE"),
8+
std::env::consts::OS,
9+
std::env::consts::ARCH
10+
)
11+
}
12+
}

0 commit comments

Comments
 (0)