diff --git a/Cargo.lock b/Cargo.lock index 45687e29..1ff4d01f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2182,6 +2182,15 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.39" @@ -2222,6 +2231,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + [[package]] name = "serde" version = "1.0.214" @@ -2908,6 +2923,7 @@ checksum = "349ed9e45296a581f455bc18039878f409992999bc1d5da12a6800eb18c8752f" dependencies = [ "anyhow", "derive_builder", + "rustc_version", "rustversion", "time", "vergen-lib", diff --git a/cspell.json b/cspell.json index b37b595d..5d3663bc 100644 --- a/cspell.json +++ b/cspell.json @@ -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":[]} \ No newline at end of file +{"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"} \ No newline at end of file diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml index 1ffad753..57edcace 100644 --- a/yazi-boot/Cargo.toml +++ b/yazi-boot/Cargo.toml @@ -24,4 +24,4 @@ clap = { workspace = true } clap_complete = "4.5.37" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.4" -vergen-gitcl = { version = "1.0.1", features = [ "build" ] } +vergen-gitcl = { version = "1.0.1", features = [ "build", "rustc" ] } diff --git a/yazi-boot/build.rs b/yazi-boot/build.rs index c84a976c..0bf01ae0 100644 --- a/yazi-boot/build.rs +++ b/yazi-boot/build.rs @@ -5,11 +5,19 @@ use std::{env, error::Error}; use clap::CommandFactory; use clap_complete::{Shell, generate_to}; -use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder}; +use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder, RustcBuilder}; fn main() -> Result<(), Box> { 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()?, + )? .add_instructions(&GitclBuilder::default().commit_date(true).sha(true).build()?)? .emit()?; diff --git a/yazi-boot/src/actions/debug.rs b/yazi-boot/src/actions/debug.rs index 2b5477be..95f53ad6 100644 --- a/yazi-boot/src/actions/debug.rs +++ b/yazi-boot/src/actions/debug.rs @@ -8,13 +8,12 @@ use super::Actions; impl Actions { pub(super) fn debug() -> Result { - use std::env::consts::{ARCH, FAMILY, OS}; let mut s = String::new(); - writeln!(s, "\nYazi")?; writeln!(s, " Version: {}", Self::version())?; writeln!(s, " Debug : {}", cfg!(debug_assertions))?; - writeln!(s, " OS : {}-{} ({})", OS, ARCH, FAMILY)?; + writeln!(s, " Triple : {}", Self::triple())?; + writeln!(s, " Rustc : {}", Self::rustc())?; writeln!(s, "\nYa")?; writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?; @@ -43,13 +42,13 @@ impl Actions { writeln!(s, " WSL: {:?}", *yazi_adapter::WSL)?; writeln!(s, "\nVariables")?; - writeln!(s, " SHELL : {:?}", env::var_os("SHELL"))?; - writeln!(s, " EDITOR : {:?}", env::var_os("EDITOR"))?; - writeln!(s, " VISUAL : {:?}", env::var_os("VISUAL"))?; - writeln!(s, " YAZI_FILE_ONE : {:?}", env::var_os("YAZI_FILE_ONE"))?; - writeln!(s, " YAZI_CONFIG_HOME : {:?}", env::var_os("YAZI_CONFIG_HOME"))?; - writeln!(s, " YAZI_ZOXIDE_OPTS : {:?}", env::var_os("YAZI_ZOXIDE_OPTS"))?; - writeln!(s, " FZF_DEFAULT_OPTS : {:?}", env::var_os("FZF_DEFAULT_OPTS"))?; + writeln!(s, " SHELL : {:?}", env::var_os("SHELL"))?; + writeln!(s, " EDITOR : {:?}", env::var_os("EDITOR"))?; + writeln!(s, " VISUAL : {:?}", env::var_os("VISUAL"))?; + writeln!(s, " YAZI_FILE_ONE : {:?}", env::var_os("YAZI_FILE_ONE"))?; + writeln!(s, " YAZI_CONFIG_HOME: {:?}", env::var_os("YAZI_CONFIG_HOME"))?; + writeln!(s, " YAZI_ZOXIDE_OPTS: {:?}", env::var_os("YAZI_ZOXIDE_OPTS"))?; + writeln!(s, " FZF_DEFAULT_OPTS: {:?}", env::var_os("FZF_DEFAULT_OPTS"))?; writeln!(s, "\nText Opener")?; writeln!( @@ -76,11 +75,8 @@ impl Actions { writeln!(s, " Zellij version : {}", Self::process_output("zellij", "--version"))?; writeln!(s, "\nDependencies")?; - writeln!( - s, - " file : {}", - Self::process_output(env::var_os("YAZI_FILE_ONE").unwrap_or("file".into()), "--version") - )?; + #[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, " ffmpegthumbnailer: {}", Self::process_output("ffmpegthumbnailer", "-v"))?; writeln!(s, " magick : {}", Self::process_output("magick", "--version"))?; @@ -93,10 +89,12 @@ impl Actions { writeln!(s, " 7z : {}", Self::process_output("7z", "i"))?; writeln!(s, " 7zz : {}", Self::process_output("7zz", "i"))?; writeln!(s, " jq : {}", Self::process_output("jq", "--version"))?; - writeln!(s, " xclip : {}", Self::process_output("xclip", "-version"))?; - writeln!(s, " wl-clipboard : {}", Self::process_output("wl-copy", "-v"))?; - writeln!(s, " xsel : {}", Self::process_output("xsel", "--version"))?; - writeln!(s, " rustc : {}", Self::process_output("rustc", "--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, "\n\n--------------------------------------------------")?; writeln!( diff --git a/yazi-boot/src/actions/mod.rs b/yazi-boot/src/actions/mod.rs index 6a323541..4f7b0221 100644 --- a/yazi-boot/src/actions/mod.rs +++ b/yazi-boot/src/actions/mod.rs @@ -1,3 +1,3 @@ #![allow(clippy::module_inception)] -yazi_macro::mod_flat!(actions clear_cache debug version); +yazi_macro::mod_flat!(actions clear_cache debug rustc triple version); diff --git a/yazi-boot/src/actions/rustc.rs b/yazi-boot/src/actions/rustc.rs new file mode 100644 index 00000000..834ba6e5 --- /dev/null +++ b/yazi-boot/src/actions/rustc.rs @@ -0,0 +1,12 @@ +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") + ) + } +} diff --git a/yazi-boot/src/actions/triple.rs b/yazi-boot/src/actions/triple.rs new file mode 100644 index 00000000..04dafcfc --- /dev/null +++ b/yazi-boot/src/actions/triple.rs @@ -0,0 +1,12 @@ +use super::Actions; + +impl Actions { + pub(super) fn triple() -> String { + format!( + "{} ({}-{})", + env!("VERGEN_RUSTC_HOST_TRIPLE"), + std::env::consts::OS, + std::env::consts::ARCH + ) + } +}