This commit is contained in:
sxyazi 2024-11-10 22:36:16 +08:00
parent ad45181e7f
commit 0d344d6879
No known key found for this signature in database
8 changed files with 69 additions and 23 deletions

16
Cargo.lock generated
View file

@ -2182,6 +2182,15 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" 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]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.39" version = "0.38.39"
@ -2222,6 +2231,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.214" version = "1.0.214"
@ -2908,6 +2923,7 @@ checksum = "349ed9e45296a581f455bc18039878f409992999bc1d5da12a6800eb18c8752f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"derive_builder", "derive_builder",
"rustc_version",
"rustversion", "rustversion",
"time", "time",
"vergen-lib", "vergen-lib",

View file

@ -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":[]} {"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"}

View file

@ -24,4 +24,4 @@ clap = { workspace = true }
clap_complete = "4.5.37" clap_complete = "4.5.37"
clap_complete_fig = "4.5.2" clap_complete_fig = "4.5.2"
clap_complete_nushell = "4.5.4" clap_complete_nushell = "4.5.4"
vergen-gitcl = { version = "1.0.1", features = [ "build" ] } vergen-gitcl = { version = "1.0.1", features = [ "build", "rustc" ] }

View file

@ -5,11 +5,19 @@ use std::{env, error::Error};
use clap::CommandFactory; use clap::CommandFactory;
use clap_complete::{Shell, generate_to}; use clap_complete::{Shell, generate_to};
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder}; use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder, RustcBuilder};
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
Emitter::default() Emitter::default()
.add_instructions(&BuildBuilder::default().build_date(true).build()?)? .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()?)? .add_instructions(&GitclBuilder::default().commit_date(true).sha(true).build()?)?
.emit()?; .emit()?;

View file

@ -8,13 +8,12 @@ use super::Actions;
impl Actions { impl Actions {
pub(super) fn debug() -> Result<String, std::fmt::Error> { pub(super) fn debug() -> Result<String, std::fmt::Error> {
use std::env::consts::{ARCH, FAMILY, OS};
let mut s = String::new(); let mut s = String::new();
writeln!(s, "\nYazi")?; writeln!(s, "\nYazi")?;
writeln!(s, " Version: {}", Self::version())?; writeln!(s, " Version: {}", Self::version())?;
writeln!(s, " Debug : {}", cfg!(debug_assertions))?; 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, "\nYa")?;
writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?; writeln!(s, " Version: {}", Self::process_output("ya", "--version"))?;
@ -76,11 +75,8 @@ impl Actions {
writeln!(s, " Zellij version : {}", Self::process_output("zellij", "--version"))?; writeln!(s, " Zellij version : {}", Self::process_output("zellij", "--version"))?;
writeln!(s, "\nDependencies")?; writeln!(s, "\nDependencies")?;
writeln!( #[rustfmt::skip]
s, writeln!(s, " file : {}", Self::process_output(env::var_os("YAZI_FILE_ONE").unwrap_or("file".into()), "--version"))?;
" 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, " ueberzugpp : {}", Self::process_output("ueberzugpp", "--version"))?;
writeln!(s, " ffmpegthumbnailer: {}", Self::process_output("ffmpegthumbnailer", "-v"))?; writeln!(s, " ffmpegthumbnailer: {}", Self::process_output("ffmpegthumbnailer", "-v"))?;
writeln!(s, " magick : {}", Self::process_output("magick", "--version"))?; writeln!(s, " magick : {}", Self::process_output("magick", "--version"))?;
@ -93,10 +89,12 @@ impl Actions {
writeln!(s, " 7z : {}", Self::process_output("7z", "i"))?; writeln!(s, " 7z : {}", Self::process_output("7z", "i"))?;
writeln!(s, " 7zz : {}", Self::process_output("7zz", "i"))?; writeln!(s, " 7zz : {}", Self::process_output("7zz", "i"))?;
writeln!(s, " jq : {}", Self::process_output("jq", "--version"))?; writeln!(s, " jq : {}", Self::process_output("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, " 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, " xsel : {}", Self::process_output("xsel", "--version"))?;
writeln!(s, " rustc : {}", Self::process_output("rustc", "--version"))?;
writeln!(s, "\n\n--------------------------------------------------")?; writeln!(s, "\n\n--------------------------------------------------")?;
writeln!( writeln!(

View file

@ -1,3 +1,3 @@
#![allow(clippy::module_inception)] #![allow(clippy::module_inception)]
yazi_macro::mod_flat!(actions clear_cache debug version); yazi_macro::mod_flat!(actions clear_cache debug rustc triple version);

View file

@ -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")
)
}
}

View file

@ -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
)
}
}