From 13e307eab27cdea1ddbfb97d62c24daf48ce7938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Sat, 12 Oct 2024 21:05:12 +0800 Subject: [PATCH] refactor: simplify module exports (#1770) --- Cargo.lock | 72 +++++++++++-------- Cargo.toml | 2 +- cspell.json | 2 +- yazi-adapter/Cargo.toml | 1 + yazi-adapter/src/lib.rs | 27 +------ yazi-boot/Cargo.toml | 7 +- yazi-boot/src/actions/mod.rs | 7 +- yazi-boot/src/lib.rs | 11 ++- yazi-cli/Cargo.toml | 5 +- yazi-cli/src/main.rs | 6 +- yazi-cli/src/package/mod.rs | 10 +-- yazi-config/Cargo.toml | 1 + yazi-config/src/keymap/mod.rs | 12 +--- yazi-config/src/lib.rs | 25 ++----- yazi-config/src/log/mod.rs | 4 +- yazi-config/src/manager/mod.rs | 10 +-- yazi-config/src/open/mod.rs | 8 +-- yazi-config/src/plugin/mod.rs | 10 +-- yazi-config/src/popup/mod.rs | 16 +---- yazi-config/src/preset.rs | 3 +- yazi-config/src/preview/mod.rs | 6 +- yazi-config/src/tasks/mod.rs | 4 +- yazi-config/src/theme/mod.rs | 12 +--- yazi-config/src/which/mod.rs | 6 +- yazi-core/Cargo.toml | 1 + yazi-core/src/completion/commands/arrow.rs | 5 +- yazi-core/src/completion/commands/close.rs | 5 +- yazi-core/src/completion/commands/mod.rs | 5 +- yazi-core/src/completion/commands/show.rs | 5 +- yazi-core/src/completion/commands/trigger.rs | 5 +- yazi-core/src/completion/mod.rs | 5 +- yazi-core/src/confirm/commands/arrow.rs | 5 +- yazi-core/src/confirm/commands/close.rs | 5 +- yazi-core/src/confirm/commands/mod.rs | 4 +- yazi-core/src/confirm/commands/show.rs | 3 +- yazi-core/src/confirm/mod.rs | 5 +- yazi-core/src/help/commands/arrow.rs | 5 +- yazi-core/src/help/commands/escape.rs | 3 +- yazi-core/src/help/commands/filter.rs | 3 +- yazi-core/src/help/commands/mod.rs | 4 +- yazi-core/src/help/help.rs | 3 +- yazi-core/src/help/mod.rs | 5 +- yazi-core/src/input/commands/backspace.rs | 5 +- yazi-core/src/input/commands/close.rs | 5 +- yazi-core/src/input/commands/complete.rs | 5 +- yazi-core/src/input/commands/delete.rs | 5 +- yazi-core/src/input/commands/escape.rs | 5 +- yazi-core/src/input/commands/forward.rs | 2 +- yazi-core/src/input/commands/insert.rs | 5 +- yazi-core/src/input/commands/kill.rs | 5 +- yazi-core/src/input/commands/mod.rs | 21 ++---- yazi-core/src/input/commands/move_.rs | 5 +- yazi-core/src/input/commands/paste.rs | 5 +- yazi-core/src/input/commands/redo.rs | 3 +- yazi-core/src/input/commands/show.rs | 3 +- yazi-core/src/input/commands/type_.rs | 2 +- yazi-core/src/input/commands/undo.rs | 3 +- yazi-core/src/input/commands/visual.rs | 3 +- yazi-core/src/input/commands/yank.rs | 3 +- yazi-core/src/input/input.rs | 3 +- yazi-core/src/input/mod.rs | 13 +--- yazi-core/src/lib.rs | 11 +-- yazi-core/src/manager/commands/create.rs | 2 +- yazi-core/src/manager/commands/hardlink.rs | 2 +- yazi-core/src/manager/commands/hover.rs | 5 +- yazi-core/src/manager/commands/link.rs | 2 +- yazi-core/src/manager/commands/mod.rs | 54 +++++++------- yazi-core/src/manager/commands/open.rs | 5 +- yazi-core/src/manager/commands/paste.rs | 2 +- yazi-core/src/manager/commands/peek.rs | 2 +- yazi-core/src/manager/commands/quit.rs | 5 +- yazi-core/src/manager/commands/remove.rs | 2 +- yazi-core/src/manager/commands/rename.rs | 2 +- yazi-core/src/manager/commands/seek.rs | 2 +- yazi-core/src/manager/commands/tab_close.rs | 5 +- yazi-core/src/manager/commands/tab_create.rs | 5 +- yazi-core/src/manager/commands/tab_swap.rs | 5 +- yazi-core/src/manager/commands/tab_switch.rs | 5 +- yazi-core/src/manager/commands/unyank.rs | 5 +- .../src/manager/commands/update_files.rs | 3 +- .../src/manager/commands/update_mimetype.rs | 3 +- .../src/manager/commands/update_yanked.rs | 3 +- yazi-core/src/manager/commands/yank.rs | 5 +- yazi-core/src/manager/mod.rs | 15 +--- yazi-core/src/notify/commands/mod.rs | 3 +- yazi-core/src/notify/commands/push.rs | 3 +- yazi-core/src/notify/commands/tick.rs | 3 +- yazi-core/src/notify/mod.rs | 7 +- yazi-core/src/select/commands/arrow.rs | 5 +- yazi-core/src/select/commands/close.rs | 5 +- yazi-core/src/select/commands/mod.rs | 4 +- yazi-core/src/select/commands/show.rs | 3 +- yazi-core/src/select/mod.rs | 5 +- yazi-core/src/tab/commands/arrow.rs | 5 +- yazi-core/src/tab/commands/cd.rs | 5 +- yazi-core/src/tab/commands/copy.rs | 2 +- yazi-core/src/tab/commands/escape.rs | 5 +- yazi-core/src/tab/commands/filter.rs | 5 +- yazi-core/src/tab/commands/filter_do.rs | 2 +- yazi-core/src/tab/commands/find.rs | 5 +- yazi-core/src/tab/commands/find_arrow.rs | 5 +- yazi-core/src/tab/commands/find_do.rs | 2 +- yazi-core/src/tab/commands/leave.rs | 2 +- yazi-core/src/tab/commands/linemode.rs | 3 +- yazi-core/src/tab/commands/mod.rs | 48 +++++++------ yazi-core/src/tab/commands/preview.rs | 3 +- yazi-core/src/tab/commands/reveal.rs | 2 +- yazi-core/src/tab/commands/select.rs | 5 +- yazi-core/src/tab/commands/select_all.rs | 5 +- yazi-core/src/tab/commands/visual_mode.rs | 5 +- yazi-core/src/tab/mod.rs | 19 +---- yazi-core/src/tab/preview.rs | 3 +- yazi-core/src/tab/tab.rs | 3 +- yazi-core/src/tasks/commands/arrow.rs | 5 +- yazi-core/src/tasks/commands/cancel.rs | 3 +- yazi-core/src/tasks/commands/mod.rs | 7 +- yazi-core/src/tasks/commands/toggle.rs | 5 +- yazi-core/src/tasks/mod.rs | 11 +-- yazi-core/src/tasks/tasks.rs | 3 +- yazi-core/src/which/commands/mod.rs | 3 +- yazi-core/src/which/commands/show.rs | 3 +- yazi-core/src/which/mod.rs | 7 +- yazi-core/src/which/sorter.rs | 2 +- yazi-core/src/which/which.rs | 3 +- yazi-dds/Cargo.toml | 1 + yazi-dds/src/body/mod.rs | 32 +-------- yazi-dds/src/lib.rs | 20 +----- yazi-dds/src/payload.rs | 3 +- yazi-fm/Cargo.toml | 1 + yazi-fm/src/app/app.rs | 3 +- yazi-fm/src/app/commands/mod.rs | 24 ++++--- yazi-fm/src/app/commands/mouse.rs | 2 +- yazi-fm/src/app/commands/plugin.rs | 3 +- yazi-fm/src/app/commands/resize.rs | 2 +- yazi-fm/src/app/commands/stop.rs | 2 +- yazi-fm/src/app/commands/update_progress.rs | 3 +- yazi-fm/src/app/mod.rs | 5 +- yazi-fm/src/completion/mod.rs | 4 +- yazi-fm/src/components/mod.rs | 6 +- yazi-fm/src/confirm/mod.rs | 10 +-- yazi-fm/src/help/mod.rs | 6 +- yazi-fm/src/input/mod.rs | 4 +- yazi-fm/src/lives/mod.rs | 35 ++------- yazi-fm/src/main.rs | 32 ++------- yazi-fm/src/notify/mod.rs | 4 +- yazi-fm/src/router.rs | 3 +- yazi-fm/src/select/mod.rs | 4 +- yazi-fm/src/tasks/mod.rs | 4 +- yazi-fm/src/term.rs | 2 +- yazi-fm/src/which/mod.rs | 6 +- yazi-fs/Cargo.toml | 2 +- yazi-fs/src/lib.rs | 14 +--- yazi-fs/src/sorter.rs | 2 +- .../src/macros.rs => yazi-macro/src/asset.rs | 20 +++++- yazi-macro/src/event.rs | 39 ++++++++++ yazi-macro/src/lib.rs | 2 + yazi-macro/src/module.rs | 11 ++- yazi-plugin/Cargo.toml | 1 + yazi-plugin/src/bindings/input.rs | 2 +- yazi-plugin/src/bindings/mod.rs | 18 +---- yazi-plugin/src/cha/mod.rs | 4 +- yazi-plugin/src/elements/mod.rs | 35 ++------- yazi-plugin/src/external/highlighter.rs | 2 +- yazi-plugin/src/external/mod.rs | 8 +-- yazi-plugin/src/file/mod.rs | 4 +- yazi-plugin/src/fs/mod.rs | 4 +- yazi-plugin/src/isolate/isolate.rs | 3 +- yazi-plugin/src/isolate/mod.rs | 14 +--- yazi-plugin/src/isolate/peek.rs | 3 +- yazi-plugin/src/isolate/seek.rs | 3 +- yazi-plugin/src/lib.rs | 29 ++------ yazi-plugin/src/loader/loader.rs | 3 +- yazi-plugin/src/loader/mod.rs | 6 +- yazi-plugin/src/lua.rs | 3 +- yazi-plugin/src/macros.rs | 18 ----- yazi-plugin/src/process/mod.rs | 12 +--- yazi-plugin/src/pubsub/mod.rs | 4 +- yazi-plugin/src/url/mod.rs | 4 +- yazi-plugin/src/utils/call.rs | 3 +- yazi-plugin/src/utils/layer.rs | 3 +- yazi-plugin/src/utils/mod.rs | 19 +---- yazi-plugin/src/utils/preview.rs | 3 +- yazi-plugin/src/utils/sync.rs | 3 +- yazi-proxy/Cargo.toml | 1 + yazi-proxy/src/app.rs | 3 +- yazi-proxy/src/completion.rs | 3 +- yazi-proxy/src/confirm.rs | 3 +- yazi-proxy/src/input.rs | 3 +- yazi-proxy/src/lib.rs | 21 +----- yazi-proxy/src/manager.rs | 3 +- yazi-proxy/src/options/mod.rs | 10 +-- yazi-proxy/src/select.rs | 3 +- yazi-proxy/src/tab.rs | 3 +- yazi-proxy/src/tasks.rs | 3 +- yazi-scheduler/Cargo.toml | 1 + yazi-scheduler/src/file/mod.rs | 6 +- yazi-scheduler/src/lib.rs | 14 +--- yazi-scheduler/src/plugin/mod.rs | 6 +- yazi-scheduler/src/prework/mod.rs | 6 +- yazi-scheduler/src/process/mod.rs | 8 +-- yazi-shared/src/errors/mod.rs | 6 +- yazi-shared/src/event/event.rs | 16 ----- yazi-shared/src/event/mod.rs | 10 +-- yazi-shared/src/event/render.rs | 27 ------- yazi-shared/src/fs/mod.rs | 18 +---- yazi-shared/src/fs/op.rs | 4 +- yazi-shared/src/lib.rs | 42 ++--------- yazi-shared/src/theme/mod.rs | 8 +-- yazi-shared/src/translit/mod.rs | 6 +- 209 files changed, 553 insertions(+), 1021 deletions(-) rename yazi-config/src/macros.rs => yazi-macro/src/asset.rs (51%) create mode 100644 yazi-macro/src/event.rs delete mode 100644 yazi-shared/src/event/render.rs diff --git a/Cargo.lock b/Cargo.lock index f0b2bdc9..e2931bf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -339,9 +339,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.28" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -378,9 +378,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -388,9 +388,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -400,9 +400,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.32" +version = "4.5.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74a01f4f9ee6c066d42a1c8dedf0dcddad16c72a8981a309d6398de3a75b0c39" +checksum = "9646e2e245bf62f45d39a0f3f36f1171ad1ea0d6967fd114bca72cb02a8fcdfb" dependencies = [ "clap", ] @@ -419,9 +419,9 @@ dependencies = [ [[package]] name = "clap_complete_nushell" -version = "4.5.3" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe32110e006bccf720f8c9af3fee1ba7db290c724eab61544e1d3295be3a40e" +checksum = "315902e790cc6e5ddd20cbd313c1d0d49db77f191e149f96397230fb82a17677" dependencies = [ "clap", "clap_complete", @@ -640,18 +640,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", @@ -661,9 +661,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", "syn 2.0.79", @@ -1228,9 +1228,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1355,9 +1355,9 @@ dependencies = [ [[package]] name = "luajit-src" -version = "210.5.10+f725e44" +version = "210.5.11+97813fb" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a0fa0df28e21f785c48d9c0f0be355cf40658badb667284207dbb4d1e574a9" +checksum = "3015551c284515db7c30c559fc1080f9cb9ee990d1f6fca315451a107c7540bb" dependencies = [ "cc", "which", @@ -2862,9 +2862,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -2873,9 +2873,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -2888,9 +2888,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2898,9 +2898,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -2911,9 +2911,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "weezl" @@ -3208,6 +3208,7 @@ dependencies = [ "tokio", "tracing", "yazi-config", + "yazi-macro", "yazi-shared", ] @@ -3224,6 +3225,7 @@ dependencies = [ "vergen-gitcl", "yazi-adapter", "yazi-config", + "yazi-macro", "yazi-shared", ] @@ -3244,6 +3246,7 @@ dependencies = [ "vergen-gitcl", "yazi-boot", "yazi-dds", + "yazi-macro", "yazi-shared", ] @@ -3270,6 +3273,7 @@ dependencies = [ "serde", "toml", "validator", + "yazi-macro", "yazi-shared", ] @@ -3299,6 +3303,7 @@ dependencies = [ "yazi-config", "yazi-dds", "yazi-fs", + "yazi-macro", "yazi-plugin", "yazi-proxy", "yazi-scheduler", @@ -3321,6 +3326,7 @@ dependencies = [ "uzers", "vergen-gitcl", "yazi-boot", + "yazi-macro", "yazi-shared", ] @@ -3352,6 +3358,7 @@ dependencies = [ "yazi-core", "yazi-dds", "yazi-fs", + "yazi-macro", "yazi-plugin", "yazi-proxy", "yazi-shared", @@ -3363,10 +3370,10 @@ version = "0.3.3" dependencies = [ "anyhow", "futures", - "ratatui", "regex", "tokio", "yazi-config", + "yazi-macro", "yazi-proxy", "yazi-shared", ] @@ -3402,6 +3409,7 @@ dependencies = [ "yazi-boot", "yazi-config", "yazi-dds", + "yazi-macro", "yazi-prebuild", "yazi-proxy", "yazi-shared", @@ -3422,6 +3430,7 @@ dependencies = [ "shell-words", "tokio", "yazi-config", + "yazi-macro", "yazi-shared", ] @@ -3440,6 +3449,7 @@ dependencies = [ "trash", "yazi-config", "yazi-dds", + "yazi-macro", "yazi-plugin", "yazi-proxy", "yazi-shared", diff --git a/Cargo.toml b/Cargo.toml index d5d6f0d1..b56b104c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0.89" arc-swap = "1.7.1" base64 = "0.22.1" bitflags = "2.6.0" -clap = { version = "4.5.19", features = [ "derive" ] } +clap = { version = "4.5.20", features = [ "derive" ] } crossterm = { version = "0.28.1", features = [ "event-stream" ] } dirs = "5.0.1" futures = "0.3.31" diff --git a/cspell.json b/cspell.json index c24a9b1f..8863c4db 100644 --- a/cspell.json +++ b/cspell.json @@ -1 +1 @@ -{"language":"en","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"],"version":"0.2","flagWords":[]} \ No newline at end of file +{"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"],"flagWords":[],"version":"0.2","language":"en"} \ No newline at end of file diff --git a/yazi-adapter/Cargo.toml b/yazi-adapter/Cargo.toml index a87fbd2b..b32ec22a 100644 --- a/yazi-adapter/Cargo.toml +++ b/yazi-adapter/Cargo.toml @@ -10,6 +10,7 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-config = { path = "../yazi-config", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies diff --git a/yazi-adapter/src/lib.rs b/yazi-adapter/src/lib.rs index bd0d7bc0..14304e97 100644 --- a/yazi-adapter/src/lib.rs +++ b/yazi-adapter/src/lib.rs @@ -1,31 +1,10 @@ #![allow(clippy::unit_arg)] -mod adapter; -mod chafa; -mod dimension; -mod emulator; -mod iip; -mod image; -mod kgp; -mod kgp_old; -mod mux; -mod sixel; -mod ueberzug; +yazi_macro::mod_flat!( + adapter, chafa, dimension, emulator, iip, image, kgp, kgp_old, mux, sixel, ueberzug +); -pub use adapter::*; -use chafa::*; -pub use dimension::*; -pub use emulator::*; -use iip::*; -use kgp::*; -use kgp_old::*; -pub use mux::*; -use sixel::*; -use ueberzug::*; use yazi_shared::{RoCell, env_exists, in_wsl}; - -pub use crate::image::*; - pub static ADAPTOR: RoCell = RoCell::new(); // Tmux support diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml index 1272a131..ff3ee1e3 100644 --- a/yazi-boot/Cargo.toml +++ b/yazi-boot/Cargo.toml @@ -9,18 +9,19 @@ homepage = "https://yazi-rs.github.io" repository = "https://github.com/sxyazi/yazi" [dependencies] -regex = { workspace = true } yazi-adapter = { path = "../yazi-adapter", version = "0.3.3" } yazi-config = { path = "../yazi-config", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies clap = { workspace = true } +regex = { workspace = true } serde = { workspace = true } [build-dependencies] clap = { workspace = true } -clap_complete = "4.5.32" +clap_complete = "4.5.33" clap_complete_fig = "4.5.2" -clap_complete_nushell = "4.5.3" +clap_complete_nushell = "4.5.4" vergen-gitcl = { version = "1.0.1", features = [ "build" ] } diff --git a/yazi-boot/src/actions/mod.rs b/yazi-boot/src/actions/mod.rs index 6b99cea4..42b267bc 100644 --- a/yazi-boot/src/actions/mod.rs +++ b/yazi-boot/src/actions/mod.rs @@ -1,8 +1,3 @@ #![allow(clippy::module_inception)] -mod actions; -mod clear_cache; -mod debug; -mod version; - -pub(super) use actions::*; +yazi_macro::mod_flat!(actions, clear_cache, debug, version); diff --git a/yazi-boot/src/lib.rs b/yazi-boot/src/lib.rs index 944d7800..331394b8 100644 --- a/yazi-boot/src/lib.rs +++ b/yazi-boot/src/lib.rs @@ -1,13 +1,10 @@ +yazi_macro::mod_pub!(actions); + +yazi_macro::mod_flat!(args, boot); + use clap::Parser; use yazi_shared::RoCell; -mod actions; -mod args; -mod boot; - -pub use args::*; -pub use boot::*; - pub static ARGS: RoCell = RoCell::new(); pub static BOOT: RoCell = RoCell::new(); diff --git a/yazi-cli/Cargo.toml b/yazi-cli/Cargo.toml index ba8f2abe..1258094f 100644 --- a/yazi-cli/Cargo.toml +++ b/yazi-cli/Cargo.toml @@ -11,6 +11,7 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-boot = { path = "../yazi-boot", version = "0.3.3" } yazi-dds = { path = "../yazi-dds", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies @@ -26,9 +27,9 @@ toml_edit = "0.22.22" # External build dependencies anyhow = { workspace = true } clap = { workspace = true } -clap_complete = "4.5.32" +clap_complete = "4.5.33" clap_complete_fig = "4.5.2" -clap_complete_nushell = "4.5.3" +clap_complete_nushell = "4.5.4" serde_json = { workspace = true } vergen-gitcl = { version = "1.0.1", features = [ "build" ] } diff --git a/yazi-cli/src/main.rs b/yazi-cli/src/main.rs index fc4b2350..4adade6f 100644 --- a/yazi-cli/src/main.rs +++ b/yazi-cli/src/main.rs @@ -1,7 +1,7 @@ -mod args; -mod package; +yazi_macro::mod_pub!(package); + +yazi_macro::mod_flat!(args); -use args::*; use clap::Parser; #[tokio::main] diff --git a/yazi-cli/src/package/mod.rs b/yazi-cli/src/package/mod.rs index 0e614c6d..1997faa4 100644 --- a/yazi-cli/src/package/mod.rs +++ b/yazi-cli/src/package/mod.rs @@ -1,16 +1,8 @@ #![allow(clippy::module_inception)] -mod add; -mod deploy; -mod git; -mod install; -mod package; -mod parser; -mod upgrade; +yazi_macro::mod_flat!(add, deploy, git, install, package, parser, upgrade); use anyhow::Context; -use git::*; -pub(super) use package::*; pub(super) fn init() -> anyhow::Result<()> { let root = yazi_shared::Xdg::state_dir().join("packages"); diff --git a/yazi-config/Cargo.toml b/yazi-config/Cargo.toml index f2f8eb75..32fc3a9d 100644 --- a/yazi-config/Cargo.toml +++ b/yazi-config/Cargo.toml @@ -9,6 +9,7 @@ homepage = "https://yazi-rs.github.io" repository = "https://github.com/sxyazi/yazi" [dependencies] +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies diff --git a/yazi-config/src/keymap/mod.rs b/yazi-config/src/keymap/mod.rs index 92fde64b..ce3f75e8 100644 --- a/yazi-config/src/keymap/mod.rs +++ b/yazi-config/src/keymap/mod.rs @@ -1,11 +1 @@ -mod chord; -mod cow; -mod deserializers; -mod key; -mod keymap; - -pub use chord::*; -pub use cow::*; -use deserializers::*; -pub use key::*; -pub use keymap::*; +yazi_macro::mod_flat!(chord, cow, deserializers, key, keymap); diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index 910f9eed..da1efe4b 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -1,30 +1,13 @@ #![allow(clippy::module_inception)] +yazi_macro::mod_pub!(keymap, log, manager, open, plugin, popup, preview, tasks, theme, which); + +yazi_macro::mod_flat!(layout, pattern, preset, priority); + use std::str::FromStr; use yazi_shared::{RoCell, Xdg}; -pub mod keymap; -mod layout; -mod log; -mod macros; -pub mod manager; -pub mod open; -mod pattern; -pub mod plugin; -pub mod popup; -mod preset; -pub mod preview; -mod priority; -mod tasks; -pub mod theme; -pub mod which; - -pub use layout::*; -pub(crate) use pattern::*; -pub(crate) use preset::*; -pub use priority::*; - pub static LAYOUT: RoCell> = RoCell::new(); pub static KEYMAP: RoCell = RoCell::new(); diff --git a/yazi-config/src/log/mod.rs b/yazi-config/src/log/mod.rs index b19c0087..82a91e05 100644 --- a/yazi-config/src/log/mod.rs +++ b/yazi-config/src/log/mod.rs @@ -1,3 +1 @@ -mod log; - -pub use log::*; +yazi_macro::mod_flat!(log); diff --git a/yazi-config/src/manager/mod.rs b/yazi-config/src/manager/mod.rs index f8b9b13c..0b575ed4 100644 --- a/yazi-config/src/manager/mod.rs +++ b/yazi-config/src/manager/mod.rs @@ -1,9 +1 @@ -mod manager; -mod mouse; -mod ratio; -mod sorting; - -pub use manager::*; -pub use mouse::*; -pub use ratio::*; -pub use sorting::*; +yazi_macro::mod_flat!(manager, mouse, ratio, sorting); diff --git a/yazi-config/src/open/mod.rs b/yazi-config/src/open/mod.rs index 085ff005..77e69988 100644 --- a/yazi-config/src/open/mod.rs +++ b/yazi-config/src/open/mod.rs @@ -1,7 +1 @@ -mod open; -mod opener; -mod rule; - -pub use open::*; -pub use opener::*; -use rule::*; +yazi_macro::mod_flat!(open, opener, rule); diff --git a/yazi-config/src/plugin/mod.rs b/yazi-config/src/plugin/mod.rs index 5594f01f..7df6c87a 100644 --- a/yazi-config/src/plugin/mod.rs +++ b/yazi-config/src/plugin/mod.rs @@ -1,11 +1,3 @@ -mod fetcher; -mod plugin; -mod preloader; -mod previewer; - -pub use fetcher::*; -pub use plugin::*; -pub use preloader::*; -pub use previewer::*; +yazi_macro::mod_flat!(fetcher, plugin, preloader, previewer); pub const MAX_PREWORKERS: u8 = 32; diff --git a/yazi-config/src/popup/mod.rs b/yazi-config/src/popup/mod.rs index 2bcca1b2..8adc3f49 100644 --- a/yazi-config/src/popup/mod.rs +++ b/yazi-config/src/popup/mod.rs @@ -1,15 +1 @@ -mod confirm; -mod input; -mod offset; -mod options; -mod origin; -mod position; -mod select; - -pub use confirm::*; -pub use input::*; -pub use offset::*; -pub use options::*; -pub use origin::*; -pub use position::*; -pub use select::*; +yazi_macro::mod_flat!(confirm, input, offset, options, origin, position, select); diff --git a/yazi-config/src/preset.rs b/yazi-config/src/preset.rs index b95ab9cb..02cf8046 100644 --- a/yazi-config/src/preset.rs +++ b/yazi-config/src/preset.rs @@ -2,8 +2,9 @@ use std::{borrow::Cow, path::{Path, PathBuf}}; use anyhow::{Context, Result}; use toml::{Table, Value}; +use yazi_macro::config_preset as preset; -use crate::{preset, theme::Flavor}; +use crate::theme::Flavor; pub(crate) struct Preset; diff --git a/yazi-config/src/preview/mod.rs b/yazi-config/src/preview/mod.rs index c11fc775..de986496 100644 --- a/yazi-config/src/preview/mod.rs +++ b/yazi-config/src/preview/mod.rs @@ -1,5 +1 @@ -mod preview; -mod wrap; - -pub use preview::*; -pub use wrap::*; +yazi_macro::mod_flat!(preview, wrap); diff --git a/yazi-config/src/tasks/mod.rs b/yazi-config/src/tasks/mod.rs index 217c728e..84aa59ae 100644 --- a/yazi-config/src/tasks/mod.rs +++ b/yazi-config/src/tasks/mod.rs @@ -1,3 +1 @@ -mod tasks; - -pub use tasks::*; +yazi_macro::mod_flat!(tasks); diff --git a/yazi-config/src/theme/mod.rs b/yazi-config/src/theme/mod.rs index c914fef5..c83e4f80 100644 --- a/yazi-config/src/theme/mod.rs +++ b/yazi-config/src/theme/mod.rs @@ -1,11 +1 @@ -mod filetype; -mod flavor; -mod icons; -mod is; -mod theme; - -pub use filetype::*; -pub use flavor::*; -pub use icons::*; -pub use is::*; -pub use theme::*; +yazi_macro::mod_flat!(filetype, flavor, icons, is, theme); diff --git a/yazi-config/src/which/mod.rs b/yazi-config/src/which/mod.rs index 2033591b..f1bdfe23 100644 --- a/yazi-config/src/which/mod.rs +++ b/yazi-config/src/which/mod.rs @@ -1,5 +1 @@ -mod sorting; -mod which; - -pub use sorting::*; -pub use which::*; +yazi_macro::mod_flat!(sorting, which); diff --git a/yazi-core/Cargo.toml b/yazi-core/Cargo.toml index b058b4fe..f4744c63 100644 --- a/yazi-core/Cargo.toml +++ b/yazi-core/Cargo.toml @@ -15,6 +15,7 @@ yazi-codegen = { path = "../yazi-codegen", version = "0.3.3" } yazi-config = { path = "../yazi-config", version = "0.3.3" } yazi-dds = { path = "../yazi-dds", version = "0.3.3" } yazi-fs = { path = "../yazi-fs", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-plugin = { path = "../yazi-plugin", version = "0.3.3" } yazi-proxy = { path = "../yazi-proxy", version = "0.3.3" } yazi-scheduler = { path = "../yazi-scheduler", version = "0.3.3" } diff --git a/yazi-core/src/completion/commands/arrow.rs b/yazi-core/src/completion/commands/arrow.rs index 35860b4b..11dd74be 100644 --- a/yazi-core/src/completion/commands/arrow.rs +++ b/yazi-core/src/completion/commands/arrow.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::completion::Completion; -pub struct Opt { +struct Opt { step: isize, } diff --git a/yazi-core/src/completion/commands/close.rs b/yazi-core/src/completion/commands/close.rs index c7008d1a..94d84a54 100644 --- a/yazi-core/src/completion/commands/close.rs +++ b/yazi-core/src/completion/commands/close.rs @@ -1,9 +1,10 @@ +use yazi_macro::render; use yazi_proxy::InputProxy; -use yazi_shared::{event::Cmd, render}; +use yazi_shared::event::Cmd; use crate::completion::Completion; -pub struct Opt { +struct Opt { submit: bool, } diff --git a/yazi-core/src/completion/commands/mod.rs b/yazi-core/src/completion/commands/mod.rs index 7e958bd6..725cdd0c 100644 --- a/yazi-core/src/completion/commands/mod.rs +++ b/yazi-core/src/completion/commands/mod.rs @@ -1,4 +1 @@ -mod arrow; -mod close; -mod show; -mod trigger; +yazi_macro::mod_flat!(arrow, close, show, trigger); diff --git a/yazi-core/src/completion/commands/show.rs b/yazi-core/src/completion/commands/show.rs index cc0a3cff..68dd5a26 100644 --- a/yazi-core/src/completion/commands/show.rs +++ b/yazi-core/src/completion/commands/show.rs @@ -1,12 +1,13 @@ use std::{mem, ops::ControlFlow}; -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::completion::Completion; const LIMIT: usize = 30; -pub struct Opt { +struct Opt { cache: Vec, cache_name: String, word: String, diff --git a/yazi-core/src/completion/commands/trigger.rs b/yazi-core/src/completion/commands/trigger.rs index 76303359..55646f42 100644 --- a/yazi-core/src/completion/commands/trigger.rs +++ b/yazi-core/src/completion/commands/trigger.rs @@ -1,7 +1,8 @@ use std::{borrow::Cow, mem, path::{MAIN_SEPARATOR, MAIN_SEPARATOR_STR}}; use tokio::fs; -use yazi_shared::{Layer, emit, event::{Cmd, Data}, render}; +use yazi_macro::{emit, render}; +use yazi_shared::{Layer, event::{Cmd, Data}}; use crate::completion::Completion; @@ -11,7 +12,7 @@ const SEPARATOR: [char; 2] = ['/', '\\']; #[cfg(not(windows))] const SEPARATOR: char = std::path::MAIN_SEPARATOR; -pub struct Opt { +struct Opt { word: String, ticket: usize, } diff --git a/yazi-core/src/completion/mod.rs b/yazi-core/src/completion/mod.rs index de2ab003..bcc82403 100644 --- a/yazi-core/src/completion/mod.rs +++ b/yazi-core/src/completion/mod.rs @@ -1,4 +1,3 @@ -mod commands; -mod completion; +yazi_macro::mod_pub!(commands); -pub use completion::*; +yazi_macro::mod_flat!(completion); diff --git a/yazi-core/src/confirm/commands/arrow.rs b/yazi-core/src/confirm/commands/arrow.rs index 76ba73d7..8ce87a66 100644 --- a/yazi-core/src/confirm/commands/arrow.rs +++ b/yazi-core/src/confirm/commands/arrow.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::{confirm::Confirm, manager::Manager}; -pub struct Opt { +struct Opt { step: isize, } diff --git a/yazi-core/src/confirm/commands/close.rs b/yazi-core/src/confirm/commands/close.rs index d2fdd809..8050484a 100644 --- a/yazi-core/src/confirm/commands/close.rs +++ b/yazi-core/src/confirm/commands/close.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::confirm::Confirm; -pub struct Opt { +struct Opt { submit: bool, } diff --git a/yazi-core/src/confirm/commands/mod.rs b/yazi-core/src/confirm/commands/mod.rs index d36c6ae8..9fcab941 100644 --- a/yazi-core/src/confirm/commands/mod.rs +++ b/yazi-core/src/confirm/commands/mod.rs @@ -1,3 +1 @@ -mod arrow; -mod close; -mod show; +yazi_macro::mod_flat!(arrow, close, show); diff --git a/yazi-core/src/confirm/commands/show.rs b/yazi-core/src/confirm/commands/show.rs index 5ec84803..1cde9b8a 100644 --- a/yazi-core/src/confirm/commands/show.rs +++ b/yazi-core/src/confirm/commands/show.rs @@ -1,6 +1,7 @@ use tokio::sync::oneshot; use yazi_config::popup::ConfirmCfg; -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::confirm::Confirm; diff --git a/yazi-core/src/confirm/mod.rs b/yazi-core/src/confirm/mod.rs index cebfd9fa..70f87db6 100644 --- a/yazi-core/src/confirm/mod.rs +++ b/yazi-core/src/confirm/mod.rs @@ -1,4 +1,3 @@ -mod commands; -mod confirm; +yazi_macro::mod_pub!(commands); -pub use confirm::*; +yazi_macro::mod_flat!(confirm); diff --git a/yazi-core/src/help/commands/arrow.rs b/yazi-core/src/help/commands/arrow.rs index e608fe29..b0cc1661 100644 --- a/yazi-core/src/help/commands/arrow.rs +++ b/yazi-core/src/help/commands/arrow.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::help::Help; -pub struct Opt { +struct Opt { step: isize, } diff --git a/yazi-core/src/help/commands/escape.rs b/yazi-core/src/help/commands/escape.rs index 8384ac75..00817707 100644 --- a/yazi-core/src/help/commands/escape.rs +++ b/yazi-core/src/help/commands/escape.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::help::Help; diff --git a/yazi-core/src/help/commands/filter.rs b/yazi-core/src/help/commands/filter.rs index f09b9ab0..d20c1750 100644 --- a/yazi-core/src/help/commands/filter.rs +++ b/yazi-core/src/help/commands/filter.rs @@ -1,5 +1,6 @@ use yazi_config::popup::{Offset, Origin, Position}; -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::{help::Help, input::Input}; diff --git a/yazi-core/src/help/commands/mod.rs b/yazi-core/src/help/commands/mod.rs index c1e9ca7a..cfc4c62e 100644 --- a/yazi-core/src/help/commands/mod.rs +++ b/yazi-core/src/help/commands/mod.rs @@ -1,3 +1 @@ -mod arrow; -mod escape; -mod filter; +yazi_macro::mod_flat!(arrow, escape, filter); diff --git a/yazi-core/src/help/help.rs b/yazi-core/src/help/help.rs index aa6ed403..00670f8a 100644 --- a/yazi-core/src/help/help.rs +++ b/yazi-core/src/help/help.rs @@ -2,7 +2,8 @@ use crossterm::event::KeyCode; use unicode_width::UnicodeWidthStr; use yazi_adapter::Dimension; use yazi_config::{KEYMAP, keymap::{Chord, Key}}; -use yazi_shared::{Layer, render, render_and}; +use yazi_macro::{render, render_and}; +use yazi_shared::Layer; use super::HELP_MARGIN; use crate::input::Input; diff --git a/yazi-core/src/help/mod.rs b/yazi-core/src/help/mod.rs index 3420abd0..342463d3 100644 --- a/yazi-core/src/help/mod.rs +++ b/yazi-core/src/help/mod.rs @@ -1,6 +1,5 @@ -mod commands; -mod help; +yazi_macro::mod_pub!(commands); -pub use help::*; +yazi_macro::mod_flat!(help); pub const HELP_MARGIN: u16 = 1; diff --git a/yazi-core/src/input/commands/backspace.rs b/yazi-core/src/input/commands/backspace.rs index 525f2a31..972139c9 100644 --- a/yazi-core/src/input/commands/backspace.rs +++ b/yazi-core/src/input/commands/backspace.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::Input; -pub struct Opt { +struct Opt { under: bool, } diff --git a/yazi-core/src/input/commands/close.rs b/yazi-core/src/input/commands/close.rs index 5105f550..af5f7417 100644 --- a/yazi-core/src/input/commands/close.rs +++ b/yazi-core/src/input/commands/close.rs @@ -1,9 +1,10 @@ +use yazi_macro::render; use yazi_proxy::CompletionProxy; -use yazi_shared::{InputError, event::Cmd, render}; +use yazi_shared::{errors::InputError, event::Cmd}; use crate::input::Input; -pub struct Opt { +struct Opt { submit: bool, } diff --git a/yazi-core/src/input/commands/complete.rs b/yazi-core/src/input/commands/complete.rs index 21222ce0..9c7fab55 100644 --- a/yazi-core/src/input/commands/complete.rs +++ b/yazi-core/src/input/commands/complete.rs @@ -1,6 +1,7 @@ use std::path::MAIN_SEPARATOR_STR; -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::input::Input; @@ -10,7 +11,7 @@ const SEPARATOR: [char; 2] = ['/', '\\']; #[cfg(not(windows))] const SEPARATOR: char = std::path::MAIN_SEPARATOR; -pub struct Opt { +struct Opt { word: String, ticket: usize, } diff --git a/yazi-core/src/input/commands/delete.rs b/yazi-core/src/input/commands/delete.rs index ef9203a2..b55cf49f 100644 --- a/yazi-core/src/input/commands/delete.rs +++ b/yazi-core/src/input/commands/delete.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::{Input, op::InputOp}; -pub struct Opt { +struct Opt { cut: bool, insert: bool, } diff --git a/yazi-core/src/input/commands/escape.rs b/yazi-core/src/input/commands/escape.rs index 5643710c..41e6e0b7 100644 --- a/yazi-core/src/input/commands/escape.rs +++ b/yazi-core/src/input/commands/escape.rs @@ -1,9 +1,10 @@ +use yazi_macro::render; use yazi_proxy::CompletionProxy; -use yazi_shared::{event::Cmd, render}; +use yazi_shared::event::Cmd; use crate::input::{Input, InputMode, op::InputOp}; -pub struct Opt; +struct Opt; impl From for Opt { fn from(_: Cmd) -> Self { Self } diff --git a/yazi-core/src/input/commands/forward.rs b/yazi-core/src/input/commands/forward.rs index d3bf8026..5d0a9983 100644 --- a/yazi-core/src/input/commands/forward.rs +++ b/yazi-core/src/input/commands/forward.rs @@ -2,7 +2,7 @@ use yazi_shared::{CharKind, event::Cmd}; use crate::input::{Input, op::InputOp}; -pub struct Opt { +struct Opt { end_of_word: bool, } diff --git a/yazi-core/src/input/commands/insert.rs b/yazi-core/src/input/commands/insert.rs index 76a519d4..33a5aa90 100644 --- a/yazi-core/src/input/commands/insert.rs +++ b/yazi-core/src/input/commands/insert.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::{Input, InputMode, op::InputOp}; -pub struct Opt { +struct Opt { append: bool, } diff --git a/yazi-core/src/input/commands/kill.rs b/yazi-core/src/input/commands/kill.rs index b2dd34db..63cff35d 100644 --- a/yazi-core/src/input/commands/kill.rs +++ b/yazi-core/src/input/commands/kill.rs @@ -1,10 +1,11 @@ use std::ops::RangeBounds; -use yazi_shared::{CharKind, event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::{CharKind, event::Cmd}; use crate::input::Input; -pub struct Opt { +struct Opt { kind: String, } diff --git a/yazi-core/src/input/commands/mod.rs b/yazi-core/src/input/commands/mod.rs index 8759bf85..bd03c07e 100644 --- a/yazi-core/src/input/commands/mod.rs +++ b/yazi-core/src/input/commands/mod.rs @@ -1,17 +1,4 @@ -mod backspace; -mod backward; -mod close; -mod complete; -mod delete; -mod escape; -mod forward; -mod insert; -mod kill; -mod move_; -mod paste; -mod redo; -mod show; -mod type_; -mod undo; -mod visual; -mod yank; +yazi_macro::mod_flat!( + backspace, backward, close, complete, delete, escape, forward, insert, kill, move_, paste, redo, + show, type_, undo, visual, yank +); diff --git a/yazi-core/src/input/commands/move_.rs b/yazi-core/src/input/commands/move_.rs index 7b52d711..6000ed51 100644 --- a/yazi-core/src/input/commands/move_.rs +++ b/yazi-core/src/input/commands/move_.rs @@ -1,9 +1,10 @@ use unicode_width::UnicodeWidthStr; -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::input::{Input, op::InputOp, snap::InputSnap}; -pub struct Opt { +struct Opt { step: isize, in_operating: bool, } diff --git a/yazi-core/src/input/commands/paste.rs b/yazi-core/src/input/commands/paste.rs index e03f2228..1a502334 100644 --- a/yazi-core/src/input/commands/paste.rs +++ b/yazi-core/src/input/commands/paste.rs @@ -1,9 +1,10 @@ +use yazi_macro::render; use yazi_plugin::CLIPBOARD; -use yazi_shared::{event::Cmd, render}; +use yazi_shared::event::Cmd; use crate::input::{Input, op::InputOp}; -pub struct Opt { +struct Opt { before: bool, } diff --git a/yazi-core/src/input/commands/redo.rs b/yazi-core/src/input/commands/redo.rs index 0b610614..12d8ed23 100644 --- a/yazi-core/src/input/commands/redo.rs +++ b/yazi-core/src/input/commands/redo.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::Input; diff --git a/yazi-core/src/input/commands/show.rs b/yazi-core/src/input/commands/show.rs index 0442d29d..270d86b4 100644 --- a/yazi-core/src/input/commands/show.rs +++ b/yazi-core/src/input/commands/show.rs @@ -1,6 +1,7 @@ use tokio::sync::mpsc; use yazi_config::popup::InputCfg; -use yazi_shared::{InputError, event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::{errors::InputError, event::Cmd}; use crate::input::Input; diff --git a/yazi-core/src/input/commands/type_.rs b/yazi-core/src/input/commands/type_.rs index 5915ab9a..9d21f4c8 100644 --- a/yazi-core/src/input/commands/type_.rs +++ b/yazi-core/src/input/commands/type_.rs @@ -3,7 +3,7 @@ use yazi_shared::event::Cmd; use crate::input::{Input, InputMode}; -pub struct Opt; +struct Opt; impl From for Opt { fn from(_: Cmd) -> Self { Self } diff --git a/yazi-core/src/input/commands/undo.rs b/yazi-core/src/input/commands/undo.rs index ac2a7fbd..dba61968 100644 --- a/yazi-core/src/input/commands/undo.rs +++ b/yazi-core/src/input/commands/undo.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::{Input, InputMode}; diff --git a/yazi-core/src/input/commands/visual.rs b/yazi-core/src/input/commands/visual.rs index 58e65676..aff958cd 100644 --- a/yazi-core/src/input/commands/visual.rs +++ b/yazi-core/src/input/commands/visual.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::{Input, InputMode, op::InputOp}; diff --git a/yazi-core/src/input/commands/yank.rs b/yazi-core/src/input/commands/yank.rs index 8485d524..9229ff0e 100644 --- a/yazi-core/src/input/commands/yank.rs +++ b/yazi-core/src/input/commands/yank.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::input::{Input, op::InputOp}; diff --git a/yazi-core/src/input/input.rs b/yazi-core/src/input/input.rs index 21bb5c07..59486442 100644 --- a/yazi-core/src/input/input.rs +++ b/yazi-core/src/input/input.rs @@ -3,8 +3,9 @@ use std::ops::Range; use tokio::sync::mpsc::UnboundedSender; use unicode_width::UnicodeWidthStr; use yazi_config::{INPUT, popup::Position}; +use yazi_macro::render; use yazi_plugin::CLIPBOARD; -use yazi_shared::{InputError, render}; +use yazi_shared::errors::InputError; use super::{InputSnap, InputSnaps, mode::InputMode, op::InputOp}; diff --git a/yazi-core/src/input/mod.rs b/yazi-core/src/input/mod.rs index 255e7c73..a6ce5b78 100644 --- a/yazi-core/src/input/mod.rs +++ b/yazi-core/src/input/mod.rs @@ -1,12 +1,3 @@ -mod commands; -mod input; -mod mode; -mod op; -mod snap; -mod snaps; +yazi_macro::mod_pub!(commands); -pub use input::*; -pub use mode::*; -use op::*; -use snap::*; -use snaps::*; +yazi_macro::mod_flat!(input, mode, op, snap, snaps); diff --git a/yazi-core/src/lib.rs b/yazi-core/src/lib.rs index e8c1106d..952774c5 100644 --- a/yazi-core/src/lib.rs +++ b/yazi-core/src/lib.rs @@ -6,16 +6,7 @@ clippy::unit_arg )] -pub mod completion; -pub mod confirm; -pub mod help; -pub mod input; -pub mod manager; -pub mod notify; -pub mod select; -pub mod tab; -pub mod tasks; -pub mod which; +yazi_macro::mod_pub!(completion, confirm, help, input, manager, notify, select, tab, tasks, which); pub fn init() { manager::WATCHED.with(<_>::default); diff --git a/yazi-core/src/manager/commands/create.rs b/yazi-core/src/manager/commands/create.rs index ae70e481..812d2f20 100644 --- a/yazi-core/src/manager/commands/create.rs +++ b/yazi-core/src/manager/commands/create.rs @@ -8,7 +8,7 @@ use yazi_shared::{event::Cmd, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_ use crate::manager::Manager; -pub struct Opt { +struct Opt { dir: bool, force: bool, } diff --git a/yazi-core/src/manager/commands/hardlink.rs b/yazi-core/src/manager/commands/hardlink.rs index 040eb0b4..687e20a5 100644 --- a/yazi-core/src/manager/commands/hardlink.rs +++ b/yazi-core/src/manager/commands/hardlink.rs @@ -2,7 +2,7 @@ use yazi_shared::event::Cmd; use crate::{manager::Manager, tasks::Tasks}; -pub struct Opt { +struct Opt { force: bool, follow: bool, } diff --git a/yazi-core/src/manager/commands/hover.rs b/yazi-core/src/manager/commands/hover.rs index e56cc580..f31fd802 100644 --- a/yazi-core/src/manager/commands/hover.rs +++ b/yazi-core/src/manager/commands/hover.rs @@ -1,11 +1,12 @@ use std::{collections::HashSet, path::PathBuf}; use yazi_dds::Pubsub; -use yazi_shared::{event::{Cmd, Data}, fs::{Url, Urn}, render}; +use yazi_macro::render; +use yazi_shared::{event::{Cmd, Data}, fs::{Url, Urn}}; use crate::manager::Manager; -pub struct Opt { +struct Opt { url: Option, tab: Option, } diff --git a/yazi-core/src/manager/commands/link.rs b/yazi-core/src/manager/commands/link.rs index 69864b2e..0e471438 100644 --- a/yazi-core/src/manager/commands/link.rs +++ b/yazi-core/src/manager/commands/link.rs @@ -2,7 +2,7 @@ use yazi_shared::event::Cmd; use crate::{manager::Manager, tasks::Tasks}; -pub struct Opt { +struct Opt { relative: bool, force: bool, } diff --git a/yazi-core/src/manager/commands/mod.rs b/yazi-core/src/manager/commands/mod.rs index 8829cccd..f6d02117 100644 --- a/yazi-core/src/manager/commands/mod.rs +++ b/yazi-core/src/manager/commands/mod.rs @@ -1,26 +1,28 @@ -mod bulk_rename; -mod close; -mod create; -mod hardlink; -mod hover; -mod link; -mod open; -mod paste; -mod peek; -mod quit; -mod refresh; -mod remove; -mod rename; -mod seek; -mod suspend; -mod tab_close; -mod tab_create; -mod tab_swap; -mod tab_switch; -mod unyank; -mod update_files; -mod update_mimetype; -mod update_paged; -mod update_task; -mod update_yanked; -mod yank; +yazi_macro::mod_flat!( + bulk_rename, + close, + create, + hardlink, + hover, + link, + open, + paste, + peek, + quit, + refresh, + remove, + rename, + seek, + suspend, + tab_close, + tab_create, + tab_swap, + tab_switch, + unyank, + update_files, + update_mimetype, + update_paged, + update_task, + update_yanked, + yank +); diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index e91d6475..449a15d8 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -4,14 +4,15 @@ use tracing::error; use yazi_boot::ARGS; use yazi_config::{OPEN, popup::SelectCfg}; use yazi_fs::Folder; +use yazi_macro::emit; use yazi_plugin::isolate; use yazi_proxy::{ManagerProxy, TasksProxy, options::OpenDoOpt}; -use yazi_shared::{MIME_DIR, emit, event::{Cmd, EventQuit}, fs::{File, Url}}; +use yazi_shared::{MIME_DIR, event::{Cmd, EventQuit}, fs::{File, Url}}; use crate::{manager::Manager, tasks::Tasks}; #[derive(Clone, Copy)] -pub struct Opt { +struct Opt { interactive: bool, hovered: bool, } diff --git a/yazi-core/src/manager/commands/paste.rs b/yazi-core/src/manager/commands/paste.rs index ea3cca73..def667ed 100644 --- a/yazi-core/src/manager/commands/paste.rs +++ b/yazi-core/src/manager/commands/paste.rs @@ -2,7 +2,7 @@ use yazi_shared::event::Cmd; use crate::{manager::Manager, tasks::Tasks}; -pub struct Opt { +struct Opt { force: bool, follow: bool, } diff --git a/yazi-core/src/manager/commands/peek.rs b/yazi-core/src/manager/commands/peek.rs index 6902a80e..62e49738 100644 --- a/yazi-core/src/manager/commands/peek.rs +++ b/yazi-core/src/manager/commands/peek.rs @@ -3,7 +3,7 @@ use yazi_shared::{event::{Cmd, Data}, fs::Url}; use crate::manager::Manager; #[derive(Debug, Default)] -pub struct Opt { +struct Opt { skip: Option, force: bool, only_if: Option, diff --git a/yazi-core/src/manager/commands/quit.rs b/yazi-core/src/manager/commands/quit.rs index 78f1737a..51a86118 100644 --- a/yazi-core/src/manager/commands/quit.rs +++ b/yazi-core/src/manager/commands/quit.rs @@ -2,13 +2,14 @@ use std::time::Duration; use tokio::{select, time}; use yazi_config::popup::ConfirmCfg; +use yazi_macro::emit; use yazi_proxy::ConfirmProxy; -use yazi_shared::{emit, event::{Cmd, EventQuit}}; +use yazi_shared::event::{Cmd, EventQuit}; use crate::{manager::Manager, tasks::Tasks}; #[derive(Default)] -pub struct Opt { +struct Opt { no_cwd_file: bool, } impl From<()> for Opt { diff --git a/yazi-core/src/manager/commands/remove.rs b/yazi-core/src/manager/commands/remove.rs index eb693649..95bc7005 100644 --- a/yazi-core/src/manager/commands/remove.rs +++ b/yazi-core/src/manager/commands/remove.rs @@ -4,7 +4,7 @@ use yazi_shared::{event::Cmd, fs::Url}; use crate::{manager::Manager, tasks::Tasks}; -pub struct Opt { +struct Opt { force: bool, permanently: bool, hovered: bool, diff --git a/yazi-core/src/manager/commands/rename.rs b/yazi-core/src/manager/commands/rename.rs index 87f6cb0c..f9e2ceae 100644 --- a/yazi-core/src/manager/commands/rename.rs +++ b/yazi-core/src/manager/commands/rename.rs @@ -9,7 +9,7 @@ use yazi_shared::{event::Cmd, fs::{File, FilesOp, Url, UrnBuf, maybe_exists, ok_ use crate::manager::Manager; -pub struct Opt { +struct Opt { hovered: bool, force: bool, empty: String, diff --git a/yazi-core/src/manager/commands/seek.rs b/yazi-core/src/manager/commands/seek.rs index b486196d..f4cf1d65 100644 --- a/yazi-core/src/manager/commands/seek.rs +++ b/yazi-core/src/manager/commands/seek.rs @@ -5,7 +5,7 @@ use yazi_shared::{MIME_DIR, event::{Cmd, Data}}; use crate::manager::Manager; #[derive(Debug)] -pub struct Opt { +struct Opt { units: i16, } diff --git a/yazi-core/src/manager/commands/tab_close.rs b/yazi-core/src/manager/commands/tab_close.rs index b213551d..a66115ed 100644 --- a/yazi-core/src/manager/commands/tab_close.rs +++ b/yazi-core/src/manager/commands/tab_close.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::manager::Tabs; -pub struct Opt { +struct Opt { idx: usize, } diff --git a/yazi-core/src/manager/commands/tab_create.rs b/yazi-core/src/manager/commands/tab_create.rs index 24d0c011..b8ec0dde 100644 --- a/yazi-core/src/manager/commands/tab_create.rs +++ b/yazi-core/src/manager/commands/tab_create.rs @@ -1,12 +1,13 @@ use yazi_boot::BOOT; +use yazi_macro::render; use yazi_proxy::AppProxy; -use yazi_shared::{event::{Cmd, Data}, fs::Url, render}; +use yazi_shared::{event::{Cmd, Data}, fs::Url}; use crate::{manager::Tabs, tab::Tab}; const MAX_TABS: usize = 9; -pub struct Opt { +struct Opt { url: Url, current: bool, } diff --git a/yazi-core/src/manager/commands/tab_swap.rs b/yazi-core/src/manager/commands/tab_swap.rs index c42dfc30..183f005e 100644 --- a/yazi-core/src/manager/commands/tab_swap.rs +++ b/yazi-core/src/manager/commands/tab_swap.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::manager::Tabs; -pub struct Opt { +struct Opt { step: isize, } diff --git a/yazi-core/src/manager/commands/tab_switch.rs b/yazi-core/src/manager/commands/tab_switch.rs index 46273782..7e6bb0c8 100644 --- a/yazi-core/src/manager/commands/tab_switch.rs +++ b/yazi-core/src/manager/commands/tab_switch.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::manager::Tabs; -pub struct Opt { +struct Opt { step: isize, relative: bool, } diff --git a/yazi-core/src/manager/commands/unyank.rs b/yazi-core/src/manager/commands/unyank.rs index e95af63c..135c5456 100644 --- a/yazi-core/src/manager/commands/unyank.rs +++ b/yazi-core/src/manager/commands/unyank.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::manager::Manager; -pub struct Opt; +struct Opt; impl From for Opt { fn from(_: Cmd) -> Self { Self } diff --git a/yazi-core/src/manager/commands/update_files.rs b/yazi-core/src/manager/commands/update_files.rs index 75b4c088..71b39e85 100644 --- a/yazi-core/src/manager/commands/update_files.rs +++ b/yazi-core/src/manager/commands/update_files.rs @@ -1,8 +1,9 @@ use std::borrow::Cow; use yazi_fs::Folder; +use yazi_macro::render; use yazi_proxy::ManagerProxy; -use yazi_shared::{event::Cmd, fs::FilesOp, render}; +use yazi_shared::{event::Cmd, fs::FilesOp}; use crate::{manager::{LINKED, Manager}, tab::Tab, tasks::Tasks}; diff --git a/yazi-core/src/manager/commands/update_mimetype.rs b/yazi-core/src/manager/commands/update_mimetype.rs index d7d1c937..3c8400f0 100644 --- a/yazi-core/src/manager/commands/update_mimetype.rs +++ b/yazi-core/src/manager/commands/update_mimetype.rs @@ -1,7 +1,8 @@ use std::collections::HashMap; use tracing::error; -use yazi_shared::{event::Cmd, fs::Url, render}; +use yazi_macro::render; +use yazi_shared::{event::Cmd, fs::Url}; use crate::{manager::{LINKED, Manager}, tasks::Tasks}; diff --git a/yazi-core/src/manager/commands/update_yanked.rs b/yazi-core/src/manager/commands/update_yanked.rs index 9bd430a9..adbbeda3 100644 --- a/yazi-core/src/manager/commands/update_yanked.rs +++ b/yazi-core/src/manager/commands/update_yanked.rs @@ -1,6 +1,7 @@ use std::collections::HashSet; -use yazi_shared::{event::Cmd, fs::Url, render}; +use yazi_macro::render; +use yazi_shared::{event::Cmd, fs::Url}; use crate::manager::{Manager, Yanked}; diff --git a/yazi-core/src/manager/commands/yank.rs b/yazi-core/src/manager/commands/yank.rs index 88ed51b2..5da6cbc3 100644 --- a/yazi-core/src/manager/commands/yank.rs +++ b/yazi-core/src/manager/commands/yank.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::manager::{Manager, Yanked}; -pub struct Opt { +struct Opt { cut: bool, } diff --git a/yazi-core/src/manager/mod.rs b/yazi-core/src/manager/mod.rs index d1b3eef3..8cf5fa8d 100644 --- a/yazi-core/src/manager/mod.rs +++ b/yazi-core/src/manager/mod.rs @@ -1,14 +1,3 @@ -mod commands; -mod linked; -mod manager; -mod mimetype; -mod tabs; -mod watcher; -mod yanked; +yazi_macro::mod_pub!(commands); -pub use linked::*; -pub use manager::*; -pub use mimetype::*; -pub use tabs::*; -pub use watcher::*; -pub use yanked::*; +yazi_macro::mod_flat!(linked, manager, mimetype, tabs, watcher, yanked); diff --git a/yazi-core/src/notify/commands/mod.rs b/yazi-core/src/notify/commands/mod.rs index 23231d13..b8432b51 100644 --- a/yazi-core/src/notify/commands/mod.rs +++ b/yazi-core/src/notify/commands/mod.rs @@ -1,2 +1 @@ -mod push; -mod tick; +yazi_macro::mod_flat!(push, tick); diff --git a/yazi-core/src/notify/commands/push.rs b/yazi-core/src/notify/commands/push.rs index b9ebf25d..3befaed5 100644 --- a/yazi-core/src/notify/commands/push.rs +++ b/yazi-core/src/notify/commands/push.rs @@ -1,6 +1,7 @@ use std::time::Instant; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; use crate::notify::{Message, Notify}; diff --git a/yazi-core/src/notify/commands/tick.rs b/yazi-core/src/notify/commands/tick.rs index 29eb7fdd..0ab133f5 100644 --- a/yazi-core/src/notify/commands/tick.rs +++ b/yazi-core/src/notify/commands/tick.rs @@ -1,7 +1,8 @@ use std::time::Duration; use ratatui::layout::Rect; -use yazi_shared::{Layer, emit, event::{Cmd, Data}}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::{Cmd, Data}}; use crate::notify::Notify; diff --git a/yazi-core/src/notify/mod.rs b/yazi-core/src/notify/mod.rs index 3d7d03fc..9a51e43e 100644 --- a/yazi-core/src/notify/mod.rs +++ b/yazi-core/src/notify/mod.rs @@ -1,9 +1,6 @@ -mod commands; -mod message; -mod notify; +yazi_macro::mod_pub!(commands); -pub use message::*; -pub use notify::*; +yazi_macro::mod_flat!(message, notify); pub const NOTIFY_BORDER: u16 = 2; pub const NOTIFY_SPACING: u16 = 1; diff --git a/yazi-core/src/select/commands/arrow.rs b/yazi-core/src/select/commands/arrow.rs index 2b7008fb..deea6b36 100644 --- a/yazi-core/src/select/commands/arrow.rs +++ b/yazi-core/src/select/commands/arrow.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::select::Select; -pub struct Opt { +struct Opt { step: isize, } diff --git a/yazi-core/src/select/commands/close.rs b/yazi-core/src/select/commands/close.rs index ffd0af57..6e73fd8b 100644 --- a/yazi-core/src/select/commands/close.rs +++ b/yazi-core/src/select/commands/close.rs @@ -1,9 +1,10 @@ use anyhow::anyhow; -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::select::Select; -pub struct Opt { +struct Opt { submit: bool, } diff --git a/yazi-core/src/select/commands/mod.rs b/yazi-core/src/select/commands/mod.rs index d36c6ae8..9fcab941 100644 --- a/yazi-core/src/select/commands/mod.rs +++ b/yazi-core/src/select/commands/mod.rs @@ -1,3 +1 @@ -mod arrow; -mod close; -mod show; +yazi_macro::mod_flat!(arrow, close, show); diff --git a/yazi-core/src/select/commands/show.rs b/yazi-core/src/select/commands/show.rs index c273e7dc..022fb8b3 100644 --- a/yazi-core/src/select/commands/show.rs +++ b/yazi-core/src/select/commands/show.rs @@ -1,6 +1,7 @@ use tokio::sync::oneshot; use yazi_config::popup::SelectCfg; -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::select::Select; diff --git a/yazi-core/src/select/mod.rs b/yazi-core/src/select/mod.rs index f98d4db8..02c53b3c 100644 --- a/yazi-core/src/select/mod.rs +++ b/yazi-core/src/select/mod.rs @@ -1,4 +1,3 @@ -mod commands; -mod select; +yazi_macro::mod_pub!(commands); -pub use select::*; +yazi_macro::mod_flat!(select); diff --git a/yazi-core/src/tab/commands/arrow.rs b/yazi-core/src/tab/commands/arrow.rs index 6f805e77..6e29cd55 100644 --- a/yazi-core/src/tab/commands/arrow.rs +++ b/yazi-core/src/tab/commands/arrow.rs @@ -1,10 +1,11 @@ use yazi_fs::Step; +use yazi_macro::render; use yazi_proxy::ManagerProxy; -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_shared::event::{Cmd, Data}; use crate::tab::Tab; -pub struct Opt { +struct Opt { step: Step, } diff --git a/yazi-core/src/tab/commands/cd.rs b/yazi-core/src/tab/commands/cd.rs index 130ff208..ae693168 100644 --- a/yazi-core/src/tab/commands/cd.rs +++ b/yazi-core/src/tab/commands/cd.rs @@ -4,12 +4,13 @@ use tokio::{fs, pin}; use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_dds::Pubsub; +use yazi_macro::render; use yazi_proxy::{CompletionProxy, InputProxy, ManagerProxy, TabProxy}; -use yazi_shared::{Debounce, InputError, event::{Cmd, Data}, fs::{Url, expand_path}, render}; +use yazi_shared::{Debounce, errors::InputError, event::{Cmd, Data}, fs::{Url, expand_path}}; use crate::tab::Tab; -pub struct Opt { +struct Opt { target: Url, interactive: bool, } diff --git a/yazi-core/src/tab/commands/copy.rs b/yazi-core/src/tab/commands/copy.rs index ea8fed4d..777c6fed 100644 --- a/yazi-core/src/tab/commands/copy.rs +++ b/yazi-core/src/tab/commands/copy.rs @@ -5,7 +5,7 @@ use yazi_shared::event::Cmd; use crate::tab::Tab; -pub struct Opt { +struct Opt { type_: String, } diff --git a/yazi-core/src/tab/commands/escape.rs b/yazi-core/src/tab/commands/escape.rs index 10fe02dd..1ca6396a 100644 --- a/yazi-core/src/tab/commands/escape.rs +++ b/yazi-core/src/tab/commands/escape.rs @@ -1,11 +1,12 @@ use bitflags::bitflags; +use yazi_macro::{render, render_and}; use yazi_proxy::{AppProxy, ManagerProxy}; -use yazi_shared::{event::Cmd, render, render_and}; +use yazi_shared::event::Cmd; use crate::tab::Tab; bitflags! { - pub struct Opt: u8 { + struct Opt: u8 { const FIND = 0b00001; const VISUAL = 0b00010; const FILTER = 0b00100; diff --git a/yazi-core/src/tab/commands/filter.rs b/yazi-core/src/tab/commands/filter.rs index b7b46efc..3cb551b9 100644 --- a/yazi-core/src/tab/commands/filter.rs +++ b/yazi-core/src/tab/commands/filter.rs @@ -4,13 +4,14 @@ use tokio::pin; use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_fs::FilterCase; +use yazi_macro::emit; use yazi_proxy::InputProxy; -use yazi_shared::{Debounce, InputError, Layer, emit, event::Cmd}; +use yazi_shared::{Debounce, Layer, errors::InputError, event::Cmd}; use crate::tab::Tab; #[derive(Default)] -pub struct Opt { +pub(super) struct Opt { pub query: String, pub case: FilterCase, pub done: bool, diff --git a/yazi-core/src/tab/commands/filter_do.rs b/yazi-core/src/tab/commands/filter_do.rs index cc1fad7f..14cb8801 100644 --- a/yazi-core/src/tab/commands/filter_do.rs +++ b/yazi-core/src/tab/commands/filter_do.rs @@ -1,6 +1,6 @@ use yazi_fs::Filter; +use yazi_macro::render; use yazi_proxy::ManagerProxy; -use yazi_shared::render; use super::filter::Opt; use crate::tab::Tab; diff --git a/yazi-core/src/tab/commands/find.rs b/yazi-core/src/tab/commands/find.rs index 24a79657..d06266e3 100644 --- a/yazi-core/src/tab/commands/find.rs +++ b/yazi-core/src/tab/commands/find.rs @@ -4,12 +4,13 @@ use tokio::pin; use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_fs::FilterCase; +use yazi_macro::emit; use yazi_proxy::InputProxy; -use yazi_shared::{Debounce, InputError, Layer, emit, event::Cmd}; +use yazi_shared::{Debounce, Layer, errors::InputError, event::Cmd}; use crate::tab::Tab; -pub struct Opt { +pub(super) struct Opt { pub(super) query: Option, pub(super) prev: bool, pub(super) case: FilterCase, diff --git a/yazi-core/src/tab/commands/find_arrow.rs b/yazi-core/src/tab/commands/find_arrow.rs index 6c217993..bdbb2739 100644 --- a/yazi-core/src/tab/commands/find_arrow.rs +++ b/yazi-core/src/tab/commands/find_arrow.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::tab::Tab; -pub struct Opt { +struct Opt { prev: bool, } diff --git a/yazi-core/src/tab/commands/find_do.rs b/yazi-core/src/tab/commands/find_do.rs index b6d41d51..732a9c60 100644 --- a/yazi-core/src/tab/commands/find_do.rs +++ b/yazi-core/src/tab/commands/find_do.rs @@ -1,4 +1,4 @@ -use yazi_shared::render; +use yazi_macro::render; use super::find::Opt; use crate::tab::{Finder, Tab}; diff --git a/yazi-core/src/tab/commands/leave.rs b/yazi-core/src/tab/commands/leave.rs index 529a28be..ccb9764c 100644 --- a/yazi-core/src/tab/commands/leave.rs +++ b/yazi-core/src/tab/commands/leave.rs @@ -2,7 +2,7 @@ use yazi_shared::event::Cmd; use crate::tab::Tab; -pub struct Opt; +struct Opt; impl From<()> for Opt { fn from(_: ()) -> Self { Self } } diff --git a/yazi-core/src/tab/commands/linemode.rs b/yazi-core/src/tab/commands/linemode.rs index 123995f2..dced281e 100644 --- a/yazi-core/src/tab/commands/linemode.rs +++ b/yazi-core/src/tab/commands/linemode.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::tab::Tab; diff --git a/yazi-core/src/tab/commands/mod.rs b/yazi-core/src/tab/commands/mod.rs index c96ee873..dddf38dc 100644 --- a/yazi-core/src/tab/commands/mod.rs +++ b/yazi-core/src/tab/commands/mod.rs @@ -1,23 +1,25 @@ -mod arrow; -mod back; -mod cd; -mod copy; -mod enter; -mod escape; -mod filter; -mod filter_do; -mod find; -mod find_arrow; -mod find_do; -mod forward; -mod hidden; -mod leave; -mod linemode; -mod preview; -mod reveal; -mod search; -mod select; -mod select_all; -mod shell; -mod sort; -mod visual_mode; +yazi_macro::mod_flat!( + arrow, + back, + cd, + copy, + enter, + escape, + filter, + filter_do, + find, + find_arrow, + find_do, + forward, + hidden, + leave, + linemode, + preview, + reveal, + search, + select, + select_all, + shell, + sort, + visual_mode +); diff --git a/yazi-core/src/tab/commands/preview.rs b/yazi-core/src/tab/commands/preview.rs index a608b886..75837b38 100644 --- a/yazi-core/src/tab/commands/preview.rs +++ b/yazi-core/src/tab/commands/preview.rs @@ -1,5 +1,6 @@ +use yazi_macro::render; use yazi_plugin::utils::PreviewLock; -use yazi_shared::{event::Cmd, render}; +use yazi_shared::event::Cmd; use crate::tab::Tab; diff --git a/yazi-core/src/tab/commands/reveal.rs b/yazi-core/src/tab/commands/reveal.rs index 5365e82e..18b7e2d7 100644 --- a/yazi-core/src/tab/commands/reveal.rs +++ b/yazi-core/src/tab/commands/reveal.rs @@ -3,7 +3,7 @@ use yazi_shared::{event::{Cmd, Data}, fs::{File, FilesOp, Url, expand_path}}; use crate::tab::Tab; -pub struct Opt { +struct Opt { target: Url, } diff --git a/yazi-core/src/tab/commands/select.rs b/yazi-core/src/tab/commands/select.rs index 5968c339..94fc57c2 100644 --- a/yazi-core/src/tab/commands/select.rs +++ b/yazi-core/src/tab/commands/select.rs @@ -1,11 +1,12 @@ use std::borrow::Cow; +use yazi_macro::render_and; use yazi_proxy::AppProxy; -use yazi_shared::{event::{Cmd, Data}, fs::Url, render, render_and}; +use yazi_shared::{event::{Cmd, Data}, fs::Url}; use crate::tab::Tab; -pub struct Opt<'a> { +struct Opt<'a> { url: Option>, state: Option, } diff --git a/yazi-core/src/tab/commands/select_all.rs b/yazi-core/src/tab/commands/select_all.rs index c5620247..4e568494 100644 --- a/yazi-core/src/tab/commands/select_all.rs +++ b/yazi-core/src/tab/commands/select_all.rs @@ -1,9 +1,10 @@ +use yazi_macro::render; use yazi_proxy::AppProxy; -use yazi_shared::{event::Cmd, render}; +use yazi_shared::event::Cmd; use crate::tab::Tab; -pub struct Opt { +struct Opt { state: Option, } diff --git a/yazi-core/src/tab/commands/visual_mode.rs b/yazi-core/src/tab/commands/visual_mode.rs index 6593da4b..fcf6369a 100644 --- a/yazi-core/src/tab/commands/visual_mode.rs +++ b/yazi-core/src/tab/commands/visual_mode.rs @@ -1,10 +1,11 @@ use std::collections::BTreeSet; -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::tab::{Mode, Tab}; -pub struct Opt { +struct Opt { unset: bool, } diff --git a/yazi-core/src/tab/mod.rs b/yazi-core/src/tab/mod.rs index 0e7d4e69..763352ad 100644 --- a/yazi-core/src/tab/mod.rs +++ b/yazi-core/src/tab/mod.rs @@ -1,18 +1,3 @@ -mod backstack; -mod commands; -mod config; -mod finder; -mod history; -mod mode; -mod preview; -mod selected; -mod tab; +yazi_macro::mod_pub!(commands); -pub use backstack::*; -pub use config::*; -pub use finder::*; -pub use history::*; -pub use mode::*; -pub use preview::*; -pub use selected::*; -pub use tab::*; +yazi_macro::mod_flat!(backstack, config, finder, history, mode, preview, selected, tab); diff --git a/yazi-core/src/tab/preview.rs b/yazi-core/src/tab/preview.rs index 1c6cae82..35bd3ae1 100644 --- a/yazi-core/src/tab/preview.rs +++ b/yazi-core/src/tab/preview.rs @@ -6,8 +6,9 @@ use tokio_util::sync::CancellationToken; use yazi_adapter::ADAPTOR; use yazi_config::PLUGIN; use yazi_fs::Files; +use yazi_macro::render; use yazi_plugin::{external::Highlighter, isolate, utils::PreviewLock}; -use yazi_shared::{MIME_DIR, fs::{Cha, File, FilesOp, Url}, render}; +use yazi_shared::{MIME_DIR, fs::{Cha, File, FilesOp, Url}}; #[derive(Default)] pub struct Preview { diff --git a/yazi-core/src/tab/tab.rs b/yazi-core/src/tab/tab.rs index 83f39f1a..4ee6250b 100644 --- a/yazi-core/src/tab/tab.rs +++ b/yazi-core/src/tab/tab.rs @@ -6,7 +6,8 @@ use tokio::task::JoinHandle; use yazi_adapter::Dimension; use yazi_config::{LAYOUT, popup::{Origin, Position}}; use yazi_fs::{Folder, FolderStage}; -use yazi_shared::{fs::Url, render}; +use yazi_macro::render; +use yazi_shared::fs::Url; use super::{Backstack, Config, Finder, History, Mode, Preview}; use crate::tab::Selected; diff --git a/yazi-core/src/tasks/commands/arrow.rs b/yazi-core/src/tasks/commands/arrow.rs index 6222a637..ba65808f 100644 --- a/yazi-core/src/tasks/commands/arrow.rs +++ b/yazi-core/src/tasks/commands/arrow.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::{Cmd, Data}, render}; +use yazi_macro::render; +use yazi_shared::event::{Cmd, Data}; use crate::tasks::Tasks; -pub struct Opt { +struct Opt { step: isize, } diff --git a/yazi-core/src/tasks/commands/cancel.rs b/yazi-core/src/tasks/commands/cancel.rs index 5b4fb30a..2b0b3e12 100644 --- a/yazi-core/src/tasks/commands/cancel.rs +++ b/yazi-core/src/tasks/commands/cancel.rs @@ -1,4 +1,5 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::tasks::Tasks; diff --git a/yazi-core/src/tasks/commands/mod.rs b/yazi-core/src/tasks/commands/mod.rs index 9456f9da..f1df829e 100644 --- a/yazi-core/src/tasks/commands/mod.rs +++ b/yazi-core/src/tasks/commands/mod.rs @@ -1,6 +1 @@ -mod arrow; -mod cancel; -mod inspect; -mod open_with; -mod process_exec; -mod toggle; +yazi_macro::mod_flat!(arrow, cancel, inspect, open_with, process_exec, toggle); diff --git a/yazi-core/src/tasks/commands/toggle.rs b/yazi-core/src/tasks/commands/toggle.rs index 46aade38..3d726352 100644 --- a/yazi-core/src/tasks/commands/toggle.rs +++ b/yazi-core/src/tasks/commands/toggle.rs @@ -1,8 +1,9 @@ -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::tasks::Tasks; -pub struct Opt; +struct Opt; impl From for Opt { fn from(_: Cmd) -> Self { Self } diff --git a/yazi-core/src/tasks/mod.rs b/yazi-core/src/tasks/mod.rs index 32abaac5..81d84f56 100644 --- a/yazi-core/src/tasks/mod.rs +++ b/yazi-core/src/tasks/mod.rs @@ -1,13 +1,6 @@ -mod commands; -mod file; -mod plugin; -mod preload; -mod process; -mod progress; -mod tasks; +yazi_macro::mod_pub!(commands); -pub use progress::*; -pub use tasks::*; +yazi_macro::mod_flat!(file, plugin, preload, process, progress, tasks); pub const TASKS_BORDER: u16 = 2; pub const TASKS_PADDING: u16 = 2; diff --git a/yazi-core/src/tasks/tasks.rs b/yazi-core/src/tasks/tasks.rs index fbc44149..ff3feecb 100644 --- a/yazi-core/src/tasks/tasks.rs +++ b/yazi-core/src/tasks/tasks.rs @@ -3,8 +3,9 @@ use std::{sync::Arc, time::Duration}; use parking_lot::Mutex; use tokio::{task::JoinHandle, time::sleep}; use yazi_adapter::Dimension; +use yazi_macro::emit; use yazi_scheduler::{Ongoing, Scheduler, TaskSummary}; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_shared::{Layer, event::Cmd}; use super::{TASKS_BORDER, TASKS_PADDING, TASKS_PERCENT, TasksProgress}; diff --git a/yazi-core/src/which/commands/mod.rs b/yazi-core/src/which/commands/mod.rs index 67954c83..8e7d873c 100644 --- a/yazi-core/src/which/commands/mod.rs +++ b/yazi-core/src/which/commands/mod.rs @@ -1,2 +1 @@ -mod callback; -mod show; +yazi_macro::mod_flat!(callback, show); diff --git a/yazi-core/src/which/commands/show.rs b/yazi-core/src/which/commands/show.rs index 8be966b4..91bba6b7 100644 --- a/yazi-core/src/which/commands/show.rs +++ b/yazi-core/src/which/commands/show.rs @@ -1,7 +1,8 @@ use std::str::FromStr; use yazi_config::{KEYMAP, keymap::{Chord, Key}}; -use yazi_shared::{Layer, event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::{Layer, event::Cmd}; use crate::which::{Which, WhichSorter}; diff --git a/yazi-core/src/which/mod.rs b/yazi-core/src/which/mod.rs index ebc217a8..038e3f24 100644 --- a/yazi-core/src/which/mod.rs +++ b/yazi-core/src/which/mod.rs @@ -1,6 +1,3 @@ -mod commands; -mod sorter; -mod which; +yazi_macro::mod_pub!(commands); -pub use sorter::*; -pub use which::*; +yazi_macro::mod_flat!(sorter, which); diff --git a/yazi-core/src/which/sorter.rs b/yazi-core/src/which/sorter.rs index d6804872..d9503b24 100644 --- a/yazi-core/src/which/sorter.rs +++ b/yazi-core/src/which/sorter.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, mem}; use yazi_config::{WHICH, keymap::ChordCow, which::SortBy}; -use yazi_shared::{Transliterator, natsort}; +use yazi_shared::{natsort, translit::Transliterator}; #[derive(Clone, Copy, PartialEq)] pub struct WhichSorter { diff --git a/yazi-core/src/which/which.rs b/yazi-core/src/which/which.rs index c604a70f..32e1bd2f 100644 --- a/yazi-core/src/which/which.rs +++ b/yazi-core/src/which/which.rs @@ -1,5 +1,6 @@ use yazi_config::keymap::{ChordCow, Key}; -use yazi_shared::{Layer, emit, render, render_and}; +use yazi_macro::{emit, render_and}; +use yazi_shared::Layer; #[derive(Default)] pub struct Which { diff --git a/yazi-dds/Cargo.toml b/yazi-dds/Cargo.toml index 424da62e..e03c0914 100644 --- a/yazi-dds/Cargo.toml +++ b/yazi-dds/Cargo.toml @@ -14,6 +14,7 @@ vendored-lua = [ "mlua/vendored" ] [dependencies] yazi-boot = { path = "../yazi-boot", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies diff --git a/yazi-dds/src/body/mod.rs b/yazi-dds/src/body/mod.rs index 4e4138bb..2d2846dc 100644 --- a/yazi-dds/src/body/mod.rs +++ b/yazi-dds/src/body/mod.rs @@ -1,31 +1,5 @@ #![allow(clippy::module_inception)] -mod body; -mod bulk; -mod bye; -mod cd; -mod custom; -mod delete; -mod hey; -mod hi; -mod hover; -mod move_; -mod rename; -mod tab; -mod trash; -mod yank; - -pub use body::*; -pub use bulk::*; -pub use bye::*; -pub use cd::*; -pub use custom::*; -pub use delete::*; -pub use hey::*; -pub use hi::*; -pub use hover::*; -pub use move_::*; -pub use rename::*; -pub use tab::*; -pub use trash::*; -pub use yank::*; +yazi_macro::mod_flat!( + body, bulk, bye, cd, custom, delete, hey, hi, hover, move_, rename, tab, trash, yank +); diff --git a/yazi-dds/src/lib.rs b/yazi-dds/src/lib.rs index df2bc66b..f206e762 100644 --- a/yazi-dds/src/lib.rs +++ b/yazi-dds/src/lib.rs @@ -1,22 +1,8 @@ #![allow(clippy::option_map_unit_fn)] -pub mod body; -mod client; -mod payload; -mod pubsub; -mod pump; -mod sendable; -mod server; -mod state; -mod stream; -pub use client::*; -pub use payload::*; -pub use pubsub::*; -pub use pump::*; -pub use sendable::*; -use server::*; -pub use state::*; -use stream::*; +yazi_macro::mod_pub!(body); + +yazi_macro::mod_flat!(client, payload, pubsub, pump, sendable, server, state, stream); pub fn init() { let (tx, rx) = tokio::sync::mpsc::unbounded_channel(); diff --git a/yazi-dds/src/payload.rs b/yazi-dds/src/payload.rs index 41db5cdb..fd6b3ca8 100644 --- a/yazi-dds/src/payload.rs +++ b/yazi-dds/src/payload.rs @@ -2,7 +2,8 @@ use std::{fmt::Display, io::Write, str::FromStr}; use anyhow::{Result, anyhow}; use yazi_boot::BOOT; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; use crate::{ID, body::Body}; diff --git a/yazi-fm/Cargo.toml b/yazi-fm/Cargo.toml index 75aad875..a614da41 100644 --- a/yazi-fm/Cargo.toml +++ b/yazi-fm/Cargo.toml @@ -20,6 +20,7 @@ yazi-config = { path = "../yazi-config", version = "0.3.3" } yazi-core = { path = "../yazi-core", version = "0.3.3" } yazi-dds = { path = "../yazi-dds", version = "0.3.3" } yazi-fs = { path = "../yazi-fs", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-plugin = { path = "../yazi-plugin", version = "0.3.3" } yazi-proxy = { path = "../yazi-proxy", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } diff --git a/yazi-fm/src/app/app.rs b/yazi-fm/src/app/app.rs index ea2d1adb..31ff6a15 100644 --- a/yazi-fm/src/app/app.rs +++ b/yazi-fm/src/app/app.rs @@ -4,7 +4,8 @@ use anyhow::Result; use crossterm::event::KeyEvent; use yazi_config::keymap::Key; use yazi_core::input::InputMode; -use yazi_shared::{Layer, emit, event::{Cmd, Event, NEED_RENDER}}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::{Cmd, Event, NEED_RENDER}}; use crate::{Ctx, Executor, Router, Signals, Term, lives::Lives}; diff --git a/yazi-fm/src/app/commands/mod.rs b/yazi-fm/src/app/commands/mod.rs index 4cc55b54..8e118986 100644 --- a/yazi-fm/src/app/commands/mod.rs +++ b/yazi-fm/src/app/commands/mod.rs @@ -1,11 +1,13 @@ -mod accept_payload; -mod mouse; -mod notify; -mod plugin; -mod quit; -mod render; -mod resize; -mod resume; -mod stop; -mod update_notify; -mod update_progress; +yazi_macro::mod_flat!( + accept_payload, + mouse, + notify, + plugin, + quit, + render, + resize, + resume, + stop, + update_notify, + update_progress +); diff --git a/yazi-fm/src/app/commands/mouse.rs b/yazi-fm/src/app/commands/mouse.rs index 152838d6..11f65fbf 100644 --- a/yazi-fm/src/app/commands/mouse.rs +++ b/yazi-fm/src/app/commands/mouse.rs @@ -6,7 +6,7 @@ use yazi_plugin::{LUA, bindings::Cast}; use crate::{app::App, lives::Lives}; -pub struct Opt { +struct Opt { event: MouseEvent, } diff --git a/yazi-fm/src/app/commands/plugin.rs b/yazi-fm/src/app/commands/plugin.rs index 4c260487..30314420 100644 --- a/yazi-fm/src/app/commands/plugin.rs +++ b/yazi-fm/src/app/commands/plugin.rs @@ -4,8 +4,9 @@ use mlua::TableExt; use scopeguard::defer; use tracing::warn; use yazi_dds::Sendable; +use yazi_macro::emit; use yazi_plugin::{LUA, RtRef, loader::LOADER}; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_shared::{Layer, event::Cmd}; use crate::{app::App, lives::Lives}; diff --git a/yazi-fm/src/app/commands/resize.rs b/yazi-fm/src/app/commands/resize.rs index 83a6843f..a8fbe0ad 100644 --- a/yazi-fm/src/app/commands/resize.rs +++ b/yazi-fm/src/app/commands/resize.rs @@ -2,7 +2,7 @@ use yazi_shared::event::Cmd; use crate::app::App; -pub struct Opt; +struct Opt; impl From for Opt { fn from(_: Cmd) -> Self { Self } diff --git a/yazi-fm/src/app/commands/stop.rs b/yazi-fm/src/app/commands/stop.rs index ac7f63fa..4342c388 100644 --- a/yazi-fm/src/app/commands/stop.rs +++ b/yazi-fm/src/app/commands/stop.rs @@ -3,7 +3,7 @@ use yazi_shared::event::Cmd; use crate::app::App; -pub struct Opt { +struct Opt { tx: Option>, } diff --git a/yazi-fm/src/app/commands/update_progress.rs b/yazi-fm/src/app/commands/update_progress.rs index 2e9cf93e..98d645b2 100644 --- a/yazi-fm/src/app/commands/update_progress.rs +++ b/yazi-fm/src/app/commands/update_progress.rs @@ -1,6 +1,7 @@ use ratatui::backend::Backend; use yazi_core::tasks::TasksProgress; -use yazi_shared::{event::Cmd, render}; +use yazi_macro::render; +use yazi_shared::event::Cmd; use crate::{app::App, components::Progress, lives::Lives}; diff --git a/yazi-fm/src/app/mod.rs b/yazi-fm/src/app/mod.rs index a64137a6..f3a7d810 100644 --- a/yazi-fm/src/app/mod.rs +++ b/yazi-fm/src/app/mod.rs @@ -1,4 +1,3 @@ -mod app; -mod commands; +yazi_macro::mod_pub!(commands); -pub(crate) use app::*; +yazi_macro::mod_flat!(app); diff --git a/yazi-fm/src/completion/mod.rs b/yazi-fm/src/completion/mod.rs index 3084e503..20a9eaee 100644 --- a/yazi-fm/src/completion/mod.rs +++ b/yazi-fm/src/completion/mod.rs @@ -1,3 +1 @@ -mod completion; - -pub(super) use completion::*; +yazi_macro::mod_flat!(completion); diff --git a/yazi-fm/src/components/mod.rs b/yazi-fm/src/components/mod.rs index 96057cdc..45c467f8 100644 --- a/yazi-fm/src/components/mod.rs +++ b/yazi-fm/src/components/mod.rs @@ -1,7 +1,3 @@ #![allow(clippy::module_inception)] -mod preview; -mod progress; - -pub(super) use preview::*; -pub(super) use progress::*; +yazi_macro::mod_flat!(preview, progress); diff --git a/yazi-fm/src/confirm/mod.rs b/yazi-fm/src/confirm/mod.rs index 567a133e..34ffe6ab 100644 --- a/yazi-fm/src/confirm/mod.rs +++ b/yazi-fm/src/confirm/mod.rs @@ -1,9 +1 @@ -mod buttons; -mod confirm; -mod content; -mod list; - -use buttons::*; -pub(super) use confirm::*; -use content::*; -use list::*; +yazi_macro::mod_flat!(buttons, confirm, content, list); diff --git a/yazi-fm/src/help/mod.rs b/yazi-fm/src/help/mod.rs index cf35bffb..bf28974f 100644 --- a/yazi-fm/src/help/mod.rs +++ b/yazi-fm/src/help/mod.rs @@ -1,5 +1 @@ -mod bindings; -mod layout; - -use bindings::*; -pub(super) use layout::*; +yazi_macro::mod_flat!(bindings, layout); diff --git a/yazi-fm/src/input/mod.rs b/yazi-fm/src/input/mod.rs index bfe62746..9ad1aafa 100644 --- a/yazi-fm/src/input/mod.rs +++ b/yazi-fm/src/input/mod.rs @@ -1,3 +1 @@ -mod input; - -pub(super) use input::*; +yazi_macro::mod_flat!(input); diff --git a/yazi-fm/src/lives/mod.rs b/yazi-fm/src/lives/mod.rs index c8ccc771..a55b4c3f 100644 --- a/yazi-fm/src/lives/mod.rs +++ b/yazi-fm/src/lives/mod.rs @@ -1,35 +1,8 @@ #![allow(clippy::module_inception)] -mod config; -mod file; -mod files; -mod filter; -mod finder; -mod folder; -mod iter; -mod lives; -mod mode; -mod preview; -mod selected; -mod tab; -mod tabs; -mod tasks; -mod yanked; - -use config::*; -use file::*; -use files::*; -use filter::*; -use finder::*; -use folder::*; -use iter::*; -pub(super) use lives::*; -use mode::*; -use preview::*; -use selected::*; -use tab::*; -use tabs::*; -use tasks::*; -use yanked::*; +yazi_macro::mod_flat!( + config, file, files, filter, finder, folder, iter, lives, mode, preview, selected, tab, tabs, + tasks, yanked +); type CtxRef<'lua> = mlua::UserDataRef<'lua, crate::Ctx>; diff --git a/yazi-fm/src/main.rs b/yazi-fm/src/main.rs index 617cebad..d2a8b4ef 100644 --- a/yazi-fm/src/main.rs +++ b/yazi-fm/src/main.rs @@ -5,35 +5,11 @@ #[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; -mod app; -mod completion; -mod components; -mod confirm; -mod context; -mod executor; -mod help; -mod input; -mod lives; -mod logs; -mod notify; -mod panic; -mod root; -mod router; -mod select; -mod signals; -mod tasks; -mod term; -mod which; +yazi_macro::mod_pub!( + app, completion, components, confirm, help, input, lives, notify, select, tasks, which +); -use context::*; -use executor::*; -use logs::*; -use panic::*; -#[allow(unused_imports)] -use root::*; -use router::*; -use signals::*; -use term::*; +yazi_macro::mod_flat!(context, executor, logs, panic, root, router, signals, term); #[tokio::main] async fn main() -> anyhow::Result<()> { diff --git a/yazi-fm/src/notify/mod.rs b/yazi-fm/src/notify/mod.rs index 03520470..b6274db1 100644 --- a/yazi-fm/src/notify/mod.rs +++ b/yazi-fm/src/notify/mod.rs @@ -1,3 +1 @@ -mod layout; - -pub(super) use layout::*; +yazi_macro::mod_flat!(layout); diff --git a/yazi-fm/src/router.rs b/yazi-fm/src/router.rs index c6350a30..dc56e9c5 100644 --- a/yazi-fm/src/router.rs +++ b/yazi-fm/src/router.rs @@ -1,5 +1,6 @@ use yazi_config::{KEYMAP, keymap::{Chord, Key}}; -use yazi_shared::{Layer, emit}; +use yazi_macro::emit; +use yazi_shared::Layer; use crate::app::App; diff --git a/yazi-fm/src/select/mod.rs b/yazi-fm/src/select/mod.rs index d4c70f1a..fae8b47f 100644 --- a/yazi-fm/src/select/mod.rs +++ b/yazi-fm/src/select/mod.rs @@ -1,3 +1 @@ -mod select; - -pub(super) use select::*; +yazi_macro::mod_flat!(select); diff --git a/yazi-fm/src/tasks/mod.rs b/yazi-fm/src/tasks/mod.rs index 03520470..b6274db1 100644 --- a/yazi-fm/src/tasks/mod.rs +++ b/yazi-fm/src/tasks/mod.rs @@ -1,3 +1 @@ -mod layout; - -pub(super) use layout::*; +yazi_macro::mod_flat!(layout); diff --git a/yazi-fm/src/term.rs b/yazi-fm/src/term.rs index 53edfcb0..b8143a81 100644 --- a/yazi-fm/src/term.rs +++ b/yazi-fm/src/term.rs @@ -30,7 +30,7 @@ impl Term { BufWriter::new(stderr()), Print(Mux::csi("\x1b[?12$p")), // Request cursor blink status (DECSET) Print(Mux::csi("\x1bP$q q\x1b\\")), // Request cursor shape (DECRQM) - Print(Mux::csi("\x1b[?u\x1b[c")), // Request keyboard enhancement flags (CSI u) + Print(Mux::csi("\x1b[?u\x1b[0c")), // Request keyboard enhancement flags (CSI u) EnterAlternateScreen, EnableBracketedPaste, mouse::SetMouse(true), diff --git a/yazi-fm/src/which/mod.rs b/yazi-fm/src/which/mod.rs index e456039b..43d97037 100644 --- a/yazi-fm/src/which/mod.rs +++ b/yazi-fm/src/which/mod.rs @@ -1,5 +1 @@ -mod cand; -mod layout; - -use cand::*; -pub(super) use layout::*; +yazi_macro::mod_flat!(cand, layout); diff --git a/yazi-fs/Cargo.toml b/yazi-fs/Cargo.toml index bd76dace..269d11ff 100644 --- a/yazi-fs/Cargo.toml +++ b/yazi-fs/Cargo.toml @@ -10,12 +10,12 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-config = { path = "../yazi-config", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-proxy = { path = "../yazi-proxy", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies anyhow = { workspace = true } futures = { workspace = true } -ratatui = { workspace = true } regex = { workspace = true } tokio = { workspace = true } diff --git a/yazi-fs/src/lib.rs b/yazi-fs/src/lib.rs index 2b7567c3..7e206169 100644 --- a/yazi-fs/src/lib.rs +++ b/yazi-fs/src/lib.rs @@ -1,15 +1,3 @@ #![allow(clippy::if_same_then_else)] -mod files; -mod filter; -mod folder; -mod sorter; -mod stage; -mod step; - -pub use files::*; -pub use filter::*; -pub use folder::*; -pub use sorter::*; -pub use stage::*; -pub use step::*; +yazi_macro::mod_flat!(files, filter, folder, sorter, stage, step); diff --git a/yazi-fs/src/sorter.rs b/yazi-fs/src/sorter.rs index 59cd87a5..fee270bc 100644 --- a/yazi-fs/src/sorter.rs +++ b/yazi-fs/src/sorter.rs @@ -1,7 +1,7 @@ use std::{cmp::Ordering, collections::HashMap, mem}; use yazi_config::manager::SortBy; -use yazi_shared::{LcgRng, Transliterator, fs::{File, UrnBuf}, natsort}; +use yazi_shared::{LcgRng, fs::{File, UrnBuf}, natsort, translit::Transliterator}; #[derive(Clone, Copy, Default, PartialEq)] pub struct FilesSorter { diff --git a/yazi-config/src/macros.rs b/yazi-macro/src/asset.rs similarity index 51% rename from yazi-config/src/macros.rs rename to yazi-macro/src/asset.rs index 63d5d099..fc33384f 100644 --- a/yazi-config/src/macros.rs +++ b/yazi-macro/src/asset.rs @@ -1,5 +1,5 @@ #[macro_export] -macro_rules! preset { +macro_rules! config_preset { ($name:literal) => {{ #[cfg(debug_assertions)] { @@ -19,3 +19,21 @@ macro_rules! preset { } }}; } + +#[macro_export] +macro_rules! plugin_preset { + ($name:literal) => {{ + #[cfg(debug_assertions)] + { + std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/preset/", $name, ".lua")).expect(concat!( + "Failed to read 'yazi-plugin/preset/", + $name, + ".lua'" + )) + } + #[cfg(not(debug_assertions))] + { + &include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/preset/", $name, ".lua"))[..] + } + }}; +} diff --git a/yazi-macro/src/event.rs b/yazi-macro/src/event.rs new file mode 100644 index 00000000..01274662 --- /dev/null +++ b/yazi-macro/src/event.rs @@ -0,0 +1,39 @@ +#[macro_export] +macro_rules! emit { + (Quit($opt:expr)) => { + yazi_shared::event::Event::Quit($opt).emit(); + }; + (Call($cmd:expr, $layer:expr)) => { + yazi_shared::event::Event::Call($cmd, $layer).emit(); + }; + (Seq($cmds:expr, $layer:expr)) => { + yazi_shared::event::Event::Seq($cmds, $layer).emit(); + }; + ($event:ident) => { + yazi_shared::event::Event::$event.emit(); + }; +} + +#[macro_export] +macro_rules! render { + () => { + yazi_shared::event::NEED_RENDER.store(true, std::sync::atomic::Ordering::Relaxed); + }; + ($cond:expr) => { + if $cond { + render!(); + } + }; +} + +#[macro_export] +macro_rules! render_and { + ($cond:expr) => { + if $cond { + yazi_macro::render!(); + true + } else { + false + } + }; +} diff --git a/yazi-macro/src/lib.rs b/yazi-macro/src/lib.rs index 621e15f8..858310db 100644 --- a/yazi-macro/src/lib.rs +++ b/yazi-macro/src/lib.rs @@ -1,2 +1,4 @@ +mod asset; +mod event; mod module; mod platform; diff --git a/yazi-macro/src/module.rs b/yazi-macro/src/module.rs index dc3ed1e2..869f6149 100644 --- a/yazi-macro/src/module.rs +++ b/yazi-macro/src/module.rs @@ -1,5 +1,14 @@ #[macro_export] -macro_rules! mod_use { +macro_rules! mod_pub { + [ $( $name:ident $(,)? )+ ] => { + $( + pub mod $name; + )+ + }; +} + +#[macro_export] +macro_rules! mod_flat { [ $( $name:ident $(,)? )+ ] => { $( mod $name; diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml index cf326d65..d49f9706 100644 --- a/yazi-plugin/Cargo.toml +++ b/yazi-plugin/Cargo.toml @@ -17,6 +17,7 @@ yazi-adapter = { path = "../yazi-adapter", version = "0.3.3" } yazi-boot = { path = "../yazi-boot", version = "0.3.3" } yazi-config = { path = "../yazi-config", version = "0.3.3" } yazi-dds = { path = "../yazi-dds", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-proxy = { path = "../yazi-proxy", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } diff --git a/yazi-plugin/src/bindings/input.rs b/yazi-plugin/src/bindings/input.rs index 245f6d00..d865fec9 100644 --- a/yazi-plugin/src/bindings/input.rs +++ b/yazi-plugin/src/bindings/input.rs @@ -3,7 +3,7 @@ use std::pin::Pin; use mlua::{UserData, prelude::LuaUserDataMethods}; use tokio::pin; use tokio_stream::StreamExt; -use yazi_shared::InputError; +use yazi_shared::errors::InputError; pub struct InputRx>> { inner: T, diff --git a/yazi-plugin/src/bindings/mod.rs b/yazi-plugin/src/bindings/mod.rs index a0b7870e..58009cb5 100644 --- a/yazi-plugin/src/bindings/mod.rs +++ b/yazi-plugin/src/bindings/mod.rs @@ -1,19 +1,3 @@ #![allow(clippy::module_inception)] -mod bindings; -mod icon; -mod input; -mod mouse; -mod permit; -mod position; -mod range; -mod window; - -pub use bindings::*; -pub use icon::*; -pub use input::*; -pub use mouse::*; -pub use permit::*; -pub use position::*; -pub use range::*; -pub use window::*; +yazi_macro::mod_flat!(bindings, icon, input, mouse, permit, position, range, window); diff --git a/yazi-plugin/src/cha/mod.rs b/yazi-plugin/src/cha/mod.rs index 6c9c1cf7..011a648d 100644 --- a/yazi-plugin/src/cha/mod.rs +++ b/yazi-plugin/src/cha/mod.rs @@ -1,8 +1,6 @@ #![allow(clippy::module_inception)] -mod cha; - -pub use cha::*; +yazi_macro::mod_flat!(cha); pub fn pour(lua: &mlua::Lua) -> mlua::Result<()> { cha::Cha::register(lua)?; diff --git a/yazi-plugin/src/elements/mod.rs b/yazi-plugin/src/elements/mod.rs index 28ad0d3a..31b0fb75 100644 --- a/yazi-plugin/src/elements/mod.rs +++ b/yazi-plugin/src/elements/mod.rs @@ -1,33 +1,6 @@ #![allow(clippy::module_inception)] -mod bar; -mod border; -mod clear; -mod constraint; -mod elements; -mod gauge; -mod layout; -mod line; -mod list; -mod padding; -mod paragraph; -mod position; -mod rect; -mod span; -mod style; - -pub use bar::*; -pub use border::*; -pub use clear::*; -pub use constraint::*; -pub use elements::*; -pub use gauge::*; -pub use layout::*; -pub use line::*; -pub use list::*; -pub use padding::*; -pub use paragraph::*; -pub use position::*; -pub use rect::*; -pub use span::*; -pub use style::*; +yazi_macro::mod_flat!( + bar, border, clear, constraint, elements, gauge, layout, line, list, padding, paragraph, + position, rect, span, style +); diff --git a/yazi-plugin/src/external/highlighter.rs b/yazi-plugin/src/external/highlighter.rs index 09047e4c..dfc506ec 100644 --- a/yazi-plugin/src/external/highlighter.rs +++ b/yazi-plugin/src/external/highlighter.rs @@ -5,7 +5,7 @@ use ratatui::{layout::Rect, text::{Line, Span, Text}}; use syntect::{LoadingError, dumps, easy::HighlightLines, highlighting::{self, Theme, ThemeSet}, parsing::{SyntaxReference, SyntaxSet}}; use tokio::{fs::File, io::{AsyncBufReadExt, BufReader}, sync::OnceCell}; use yazi_config::{PREVIEW, THEME, preview::PreviewWrap}; -use yazi_shared::{PeekError, replace_to_printable}; +use yazi_shared::{errors::PeekError, replace_to_printable}; static INCR: AtomicUsize = AtomicUsize::new(0); static SYNTECT: OnceCell<(Theme, SyntaxSet)> = OnceCell::const_new(); diff --git a/yazi-plugin/src/external/mod.rs b/yazi-plugin/src/external/mod.rs index 5a7b270a..401e6475 100644 --- a/yazi-plugin/src/external/mod.rs +++ b/yazi-plugin/src/external/mod.rs @@ -1,7 +1 @@ -mod fd; -mod highlighter; -mod rg; - -pub use fd::*; -pub use highlighter::*; -pub use rg::*; +yazi_macro::mod_flat!(fd, highlighter, rg); diff --git a/yazi-plugin/src/file/mod.rs b/yazi-plugin/src/file/mod.rs index ac2d9fb6..cf584692 100644 --- a/yazi-plugin/src/file/mod.rs +++ b/yazi-plugin/src/file/mod.rs @@ -1,8 +1,6 @@ #![allow(clippy::module_inception)] -mod file; - -pub use file::*; +yazi_macro::mod_flat!(file); pub fn pour(lua: &mlua::Lua) -> mlua::Result<()> { file::File::register(lua)?; diff --git a/yazi-plugin/src/fs/mod.rs b/yazi-plugin/src/fs/mod.rs index 892e510e..f1b5496e 100644 --- a/yazi-plugin/src/fs/mod.rs +++ b/yazi-plugin/src/fs/mod.rs @@ -1,5 +1,3 @@ #![allow(clippy::module_inception)] -mod fs; - -pub use fs::*; +yazi_macro::mod_flat!(fs); diff --git a/yazi-plugin/src/isolate/isolate.rs b/yazi-plugin/src/isolate/isolate.rs index c49aa341..f509d802 100644 --- a/yazi-plugin/src/isolate/isolate.rs +++ b/yazi-plugin/src/isolate/isolate.rs @@ -1,6 +1,7 @@ use mlua::Lua; +use yazi_macro::plugin_preset as preset; -use crate::{elements, preset, runtime::Runtime}; +use crate::{elements, runtime::Runtime}; pub fn slim_lua(name: &str) -> mlua::Result { let lua = Lua::new(); diff --git a/yazi-plugin/src/isolate/mod.rs b/yazi-plugin/src/isolate/mod.rs index 8b14c6ca..a9ce95c2 100644 --- a/yazi-plugin/src/isolate/mod.rs +++ b/yazi-plugin/src/isolate/mod.rs @@ -1,15 +1,3 @@ #![allow(clippy::module_inception)] -mod entry; -mod fetch; -mod isolate; -mod peek; -mod preload; -mod seek; - -pub use entry::*; -pub use fetch::*; -pub use isolate::*; -pub use peek::*; -pub use preload::*; -pub use seek::*; +yazi_macro::mod_flat!(entry, fetch, isolate, peek, preload, seek); diff --git a/yazi-plugin/src/isolate/peek.rs b/yazi-plugin/src/isolate/peek.rs index d56be4a6..4c1ca3da 100644 --- a/yazi-plugin/src/isolate/peek.rs +++ b/yazi-plugin/src/isolate/peek.rs @@ -5,7 +5,8 @@ use tokio::{runtime::Handle, select}; use tokio_util::sync::CancellationToken; use tracing::error; use yazi_config::LAYOUT; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; use super::slim_lua; use crate::{LUA, Opt, OptCallback, bindings::{Cast, Window}, elements::Rect, file::File, loader::LOADER}; diff --git a/yazi-plugin/src/isolate/seek.rs b/yazi-plugin/src/isolate/seek.rs index 9306b15f..f7f248ce 100644 --- a/yazi-plugin/src/isolate/seek.rs +++ b/yazi-plugin/src/isolate/seek.rs @@ -1,6 +1,7 @@ use mlua::TableExt; use yazi_config::LAYOUT; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; use crate::{LUA, Opt, OptCallback, bindings::Cast, elements::Rect, file::File}; diff --git a/yazi-plugin/src/lib.rs b/yazi-plugin/src/lib.rs index a0a722c7..d878fc59 100644 --- a/yazi-plugin/src/lib.rs +++ b/yazi-plugin/src/lib.rs @@ -1,31 +1,12 @@ #![allow(clippy::unit_arg)] -pub mod bindings; -mod cast; -pub mod cha; -mod clipboard; -mod config; -pub mod elements; -pub mod external; -pub mod file; -pub mod fs; -pub mod isolate; -pub mod loader; -mod lua; mod macros; -mod opt; -pub mod process; -pub mod pubsub; -mod runtime; -pub mod url; -pub mod utils; -pub use cast::*; -pub use clipboard::*; -pub use config::*; -pub use lua::*; -pub use opt::*; -pub use runtime::*; +yazi_macro::mod_pub!( + bindings, cha, elements, external, file, fs, isolate, loader, process, pubsub, url, utils +); + +yazi_macro::mod_flat!(cast, clipboard, config, lua, opt, runtime); pub fn init() -> anyhow::Result<()> { CLIPBOARD.with(<_>::default); diff --git a/yazi-plugin/src/loader/loader.rs b/yazi-plugin/src/loader/loader.rs index 1e9e6cf2..030210e3 100644 --- a/yazi-plugin/src/loader/loader.rs +++ b/yazi-plugin/src/loader/loader.rs @@ -5,10 +5,9 @@ use mlua::{ExternalError, Lua, Table}; use parking_lot::RwLock; use tokio::fs; use yazi_boot::BOOT; +use yazi_macro::plugin_preset as preset; use yazi_shared::RoCell; -use crate::preset; - pub static LOADER: RoCell = RoCell::new(); #[derive(Default)] diff --git a/yazi-plugin/src/loader/mod.rs b/yazi-plugin/src/loader/mod.rs index 639a57e6..1f5cac6a 100644 --- a/yazi-plugin/src/loader/mod.rs +++ b/yazi-plugin/src/loader/mod.rs @@ -1,10 +1,6 @@ #![allow(clippy::module_inception)] -mod loader; -mod require; - -pub use loader::*; -use require::*; +yazi_macro::mod_flat!(loader, require); pub(super) fn init() { LOADER.with(<_>::default); } diff --git a/yazi-plugin/src/lua.rs b/yazi-plugin/src/lua.rs index b8e96c34..f9742d58 100644 --- a/yazi-plugin/src/lua.rs +++ b/yazi-plugin/src/lua.rs @@ -1,9 +1,10 @@ use anyhow::{Context, Result}; use mlua::Lua; use yazi_boot::BOOT; +use yazi_macro::plugin_preset as preset; use yazi_shared::RoCell; -use crate::{preset, runtime::Runtime}; +use crate::runtime::Runtime; pub static LUA: RoCell = RoCell::new(); diff --git a/yazi-plugin/src/macros.rs b/yazi-plugin/src/macros.rs index 3ddcefa8..790121cf 100644 --- a/yazi-plugin/src/macros.rs +++ b/yazi-plugin/src/macros.rs @@ -1,21 +1,3 @@ -#[macro_export] -macro_rules! preset { - ($name:literal) => {{ - #[cfg(debug_assertions)] - { - std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/preset/", $name, ".lua")).expect(concat!( - "Failed to read 'yazi-plugin/preset/", - $name, - ".lua'" - )) - } - #[cfg(not(debug_assertions))] - { - &include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/preset/", $name, ".lua"))[..] - } - }}; -} - #[macro_export] macro_rules! impl_style_method { ($methods:ident, $($field:tt).+) => { diff --git a/yazi-plugin/src/process/mod.rs b/yazi-plugin/src/process/mod.rs index e0eee968..7e7f746b 100644 --- a/yazi-plugin/src/process/mod.rs +++ b/yazi-plugin/src/process/mod.rs @@ -1,13 +1,3 @@ #![allow(clippy::module_inception)] -mod child; -mod command; -mod output; -mod process; -mod status; - -pub use child::*; -pub use command::*; -pub use output::*; -pub use process::*; -pub use status::*; +yazi_macro::mod_flat!(child, command, output, process, status); diff --git a/yazi-plugin/src/pubsub/mod.rs b/yazi-plugin/src/pubsub/mod.rs index 6baa14bc..5d087d04 100644 --- a/yazi-plugin/src/pubsub/mod.rs +++ b/yazi-plugin/src/pubsub/mod.rs @@ -1,8 +1,6 @@ #![allow(clippy::module_inception)] -mod pubsub; - -pub use pubsub::*; +yazi_macro::mod_flat!(pubsub); pub(super) fn install(lua: &'static mlua::Lua) -> mlua::Result<()> { Pubsub::install(lua)?; diff --git a/yazi-plugin/src/url/mod.rs b/yazi-plugin/src/url/mod.rs index 81119723..ba07b8b8 100644 --- a/yazi-plugin/src/url/mod.rs +++ b/yazi-plugin/src/url/mod.rs @@ -1,8 +1,6 @@ #![allow(clippy::module_inception)] -mod url; - -pub use url::*; +yazi_macro::mod_flat!(url); pub fn pour(lua: &mlua::Lua) -> mlua::Result<()> { url::Url::register(lua)?; diff --git a/yazi-plugin/src/utils/call.rs b/yazi-plugin/src/utils/call.rs index a978a1e3..968e328a 100644 --- a/yazi-plugin/src/utils/call.rs +++ b/yazi-plugin/src/utils/call.rs @@ -4,7 +4,8 @@ use mlua::{ExternalError, Lua, Table, TableExt, Value}; use tracing::error; use yazi_config::LAYOUT; use yazi_dds::Sendable; -use yazi_shared::{Layer, emit, event::{Cmd, Data}, render}; +use yazi_macro::{emit, render}; +use yazi_shared::{Layer, event::{Cmd, Data}}; use super::Utils; diff --git a/yazi-plugin/src/utils/layer.rs b/yazi-plugin/src/utils/layer.rs index 1c8afd13..587fbfc6 100644 --- a/yazi-plugin/src/utils/layer.rs +++ b/yazi-plugin/src/utils/layer.rs @@ -4,8 +4,9 @@ use mlua::{ExternalError, ExternalResult, IntoLuaMulti, Lua, Table, Value}; use tokio::sync::mpsc; use tokio_stream::wrappers::UnboundedReceiverStream; use yazi_config::{keymap::{Chord, Key}, popup::InputCfg}; +use yazi_macro::emit; use yazi_proxy::{AppProxy, InputProxy}; -use yazi_shared::{Debounce, Layer, emit, event::Cmd}; +use yazi_shared::{Debounce, Layer, event::Cmd}; use super::Utils; use crate::bindings::{InputRx, Position}; diff --git a/yazi-plugin/src/utils/mod.rs b/yazi-plugin/src/utils/mod.rs index 87107001..c3f27ebb 100644 --- a/yazi-plugin/src/utils/mod.rs +++ b/yazi-plugin/src/utils/mod.rs @@ -1,18 +1,5 @@ #![allow(clippy::module_inception)] -mod app; -mod cache; -mod call; -mod image; -mod layer; -mod log; -mod preview; -mod sync; -mod target; -mod text; -mod time; -mod user; -mod utils; - -pub use preview::*; -pub use utils::*; +yazi_macro::mod_flat!( + app, cache, call, image, layer, log, preview, sync, target, text, time, user, utils +); diff --git a/yazi-plugin/src/utils/preview.rs b/yazi-plugin/src/utils/preview.rs index 99d7e790..752439ee 100644 --- a/yazi-plugin/src/utils/preview.rs +++ b/yazi-plugin/src/utils/preview.rs @@ -1,6 +1,7 @@ use mlua::{AnyUserData, IntoLuaMulti, Lua, Table, Value}; use yazi_config::{PREVIEW, preview::PreviewWrap}; -use yazi_shared::{Layer, PeekError, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, errors::PeekError, event::Cmd}; use super::Utils; use crate::{bindings::Window, cast_to_renderable, elements::{Paragraph, Rect, Renderable, WRAP, WRAP_NO}, external::Highlighter, file::FileRef}; diff --git a/yazi-plugin/src/utils/sync.rs b/yazi-plugin/src/utils/sync.rs index c5602489..2314e3e0 100644 --- a/yazi-plugin/src/utils/sync.rs +++ b/yazi-plugin/src/utils/sync.rs @@ -1,7 +1,8 @@ use mlua::{ExternalError, ExternalResult, Function, Lua, MultiValue, Table, Value}; use tokio::sync::oneshot; use yazi_dds::Sendable; -use yazi_shared::{Layer, emit, event::{Cmd, Data}}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::{Cmd, Data}}; use super::Utils; use crate::{OptCallback, loader::LOADER, runtime::RtRef}; diff --git a/yazi-proxy/Cargo.toml b/yazi-proxy/Cargo.toml index 72c48334..600bc398 100644 --- a/yazi-proxy/Cargo.toml +++ b/yazi-proxy/Cargo.toml @@ -14,6 +14,7 @@ vendored-lua = [ "mlua/vendored" ] [dependencies] yazi-config = { path = "../yazi-config", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } # External dependencies diff --git a/yazi-proxy/src/app.rs b/yazi-proxy/src/app.rs index cea1d0fe..49845904 100644 --- a/yazi-proxy/src/app.rs +++ b/yazi-proxy/src/app.rs @@ -1,7 +1,8 @@ use std::time::Duration; use tokio::sync::oneshot; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; use crate::options::{NotifyLevel, NotifyOpt}; diff --git a/yazi-proxy/src/completion.rs b/yazi-proxy/src/completion.rs index 915a4a19..3d9331bd 100644 --- a/yazi-proxy/src/completion.rs +++ b/yazi-proxy/src/completion.rs @@ -1,4 +1,5 @@ -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; pub struct CompletionProxy; diff --git a/yazi-proxy/src/confirm.rs b/yazi-proxy/src/confirm.rs index 75c392fc..2cca1267 100644 --- a/yazi-proxy/src/confirm.rs +++ b/yazi-proxy/src/confirm.rs @@ -1,6 +1,7 @@ use tokio::sync::oneshot; use yazi_config::popup::ConfirmCfg; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; pub struct ConfirmProxy; diff --git a/yazi-proxy/src/input.rs b/yazi-proxy/src/input.rs index 6e74894c..b026f8d7 100644 --- a/yazi-proxy/src/input.rs +++ b/yazi-proxy/src/input.rs @@ -1,6 +1,7 @@ use tokio::sync::mpsc; use yazi_config::popup::InputCfg; -use yazi_shared::{InputError, Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, errors::InputError, event::Cmd}; pub struct InputProxy; diff --git a/yazi-proxy/src/lib.rs b/yazi-proxy/src/lib.rs index e87d6b60..3a781ac4 100644 --- a/yazi-proxy/src/lib.rs +++ b/yazi-proxy/src/lib.rs @@ -1,22 +1,5 @@ -mod app; -mod completion; -mod confirm; -mod input; -mod manager; -pub mod options; -mod select; -mod semaphore; -mod tab; -mod tasks; +yazi_macro::mod_pub!(options); -pub use app::*; -pub use completion::*; -pub use confirm::*; -pub use input::*; -pub use manager::*; -pub use select::*; -pub use semaphore::*; -pub use tab::*; -pub use tasks::*; +yazi_macro::mod_flat!(app, completion, confirm, input, manager, select, semaphore, tab, tasks); pub fn init() { crate::init_semaphore(); } diff --git a/yazi-proxy/src/manager.rs b/yazi-proxy/src/manager.rs index 1974e183..4ea14fe4 100644 --- a/yazi-proxy/src/manager.rs +++ b/yazi-proxy/src/manager.rs @@ -1,4 +1,5 @@ -use yazi_shared::{Layer, emit, event::Cmd, fs::Url}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd, fs::Url}; use crate::options::OpenDoOpt; diff --git a/yazi-proxy/src/options/mod.rs b/yazi-proxy/src/options/mod.rs index f2284af5..def77466 100644 --- a/yazi-proxy/src/options/mod.rs +++ b/yazi-proxy/src/options/mod.rs @@ -1,9 +1 @@ -mod notify; -mod open; -mod process; -mod search; - -pub use notify::*; -pub use open::*; -pub use process::*; -pub use search::*; +yazi_macro::mod_flat!(notify, open, process, search); diff --git a/yazi-proxy/src/select.rs b/yazi-proxy/src/select.rs index 32b62f98..35fbfcb5 100644 --- a/yazi-proxy/src/select.rs +++ b/yazi-proxy/src/select.rs @@ -1,6 +1,7 @@ use tokio::sync::oneshot; use yazi_config::popup::SelectCfg; -use yazi_shared::{Layer, emit, event::Cmd}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd}; pub struct SelectProxy; diff --git a/yazi-proxy/src/tab.rs b/yazi-proxy/src/tab.rs index 9c271e88..18a4a7da 100644 --- a/yazi-proxy/src/tab.rs +++ b/yazi-proxy/src/tab.rs @@ -1,4 +1,5 @@ -use yazi_shared::{Layer, emit, event::Cmd, fs::Url}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd, fs::Url}; use crate::options::SearchOpt; diff --git a/yazi-proxy/src/tasks.rs b/yazi-proxy/src/tasks.rs index 9ca53be6..428a82c0 100644 --- a/yazi-proxy/src/tasks.rs +++ b/yazi-proxy/src/tasks.rs @@ -2,7 +2,8 @@ use std::{borrow::Cow, ffi::OsString}; use tokio::sync::oneshot; use yazi_config::open::Opener; -use yazi_shared::{Layer, emit, event::Cmd, fs::Url}; +use yazi_macro::emit; +use yazi_shared::{Layer, event::Cmd, fs::Url}; use crate::options::{OpenWithOpt, ProcessExecOpt}; diff --git a/yazi-scheduler/Cargo.toml b/yazi-scheduler/Cargo.toml index aaf6a406..288add37 100644 --- a/yazi-scheduler/Cargo.toml +++ b/yazi-scheduler/Cargo.toml @@ -11,6 +11,7 @@ repository = "https://github.com/sxyazi/yazi" [dependencies] yazi-config = { path = "../yazi-config", version = "0.3.3" } yazi-dds = { path = "../yazi-dds", version = "0.3.3" } +yazi-macro = { path = "../yazi-macro", version = "0.3.3" } yazi-plugin = { path = "../yazi-plugin", version = "0.3.3" } yazi-proxy = { path = "../yazi-proxy", version = "0.3.3" } yazi-shared = { path = "../yazi-shared", version = "0.3.3" } diff --git a/yazi-scheduler/src/file/mod.rs b/yazi-scheduler/src/file/mod.rs index ecb518b7..fa26cdcb 100644 --- a/yazi-scheduler/src/file/mod.rs +++ b/yazi-scheduler/src/file/mod.rs @@ -1,7 +1,3 @@ #![allow(clippy::module_inception)] -mod file; -mod op; - -pub use file::*; -pub use op::*; +yazi_macro::mod_flat!(file, op); diff --git a/yazi-scheduler/src/lib.rs b/yazi-scheduler/src/lib.rs index 6e9ed29f..61a17f86 100644 --- a/yazi-scheduler/src/lib.rs +++ b/yazi-scheduler/src/lib.rs @@ -1,18 +1,8 @@ #![allow(clippy::option_map_unit_fn, clippy::unit_arg)] -mod file; -mod ongoing; -mod op; -mod plugin; -mod prework; -mod process; -mod scheduler; -mod task; +yazi_macro::mod_pub!(file, plugin, prework, process); -pub use ongoing::*; -pub use op::*; -pub use scheduler::*; -pub use task::*; +yazi_macro::mod_flat!(ongoing, op, scheduler, task); const LOW: u8 = yazi_config::Priority::Low as u8; const NORMAL: u8 = yazi_config::Priority::Normal as u8; diff --git a/yazi-scheduler/src/plugin/mod.rs b/yazi-scheduler/src/plugin/mod.rs index 4ef84332..3b406fa1 100644 --- a/yazi-scheduler/src/plugin/mod.rs +++ b/yazi-scheduler/src/plugin/mod.rs @@ -1,7 +1,3 @@ #![allow(clippy::module_inception)] -mod op; -mod plugin; - -pub use op::*; -pub use plugin::*; +yazi_macro::mod_flat!(op, plugin); diff --git a/yazi-scheduler/src/prework/mod.rs b/yazi-scheduler/src/prework/mod.rs index 4c89c36c..89f57992 100644 --- a/yazi-scheduler/src/prework/mod.rs +++ b/yazi-scheduler/src/prework/mod.rs @@ -1,7 +1,3 @@ #![allow(clippy::module_inception)] -mod op; -mod prework; - -pub use op::*; -pub use prework::*; +yazi_macro::mod_flat!(op, prework); diff --git a/yazi-scheduler/src/process/mod.rs b/yazi-scheduler/src/process/mod.rs index e78ef646..70cdb6f9 100644 --- a/yazi-scheduler/src/process/mod.rs +++ b/yazi-scheduler/src/process/mod.rs @@ -1,9 +1,3 @@ #![allow(clippy::module_inception)] -mod op; -mod process; -mod shell; - -pub use op::*; -pub use process::*; -pub use shell::*; +yazi_macro::mod_flat!(op, process, shell); diff --git a/yazi-shared/src/errors/mod.rs b/yazi-shared/src/errors/mod.rs index 9d67f513..4e9e4f21 100644 --- a/yazi-shared/src/errors/mod.rs +++ b/yazi-shared/src/errors/mod.rs @@ -1,5 +1 @@ -mod input; -mod peek; - -pub use input::*; -pub use peek::*; +yazi_macro::mod_flat!(input, peek); diff --git a/yazi-shared/src/event/event.rs b/yazi-shared/src/event/event.rs index bee1f911..8298913d 100644 --- a/yazi-shared/src/event/event.rs +++ b/yazi-shared/src/event/event.rs @@ -41,19 +41,3 @@ impl Event { #[inline] pub fn emit(self) { TX.send(self).ok(); } } - -#[macro_export] -macro_rules! emit { - (Quit($opt:expr)) => { - $crate::event::Event::Quit($opt).emit(); - }; - (Call($cmd:expr, $layer:expr)) => { - $crate::event::Event::Call($cmd, $layer).emit(); - }; - (Seq($cmds:expr, $layer:expr)) => { - $crate::event::Event::Seq($cmds, $layer).emit(); - }; - ($event:ident) => { - $crate::event::Event::$event.emit(); - }; -} diff --git a/yazi-shared/src/event/mod.rs b/yazi-shared/src/event/mod.rs index 4c090ffb..41bf7d0d 100644 --- a/yazi-shared/src/event/mod.rs +++ b/yazi-shared/src/event/mod.rs @@ -1,11 +1,5 @@ #![allow(clippy::module_inception)] -mod cmd; -mod data; -mod event; -mod render; +yazi_macro::mod_flat!(cmd, data, event); -pub use cmd::*; -pub use data::*; -pub use event::*; -pub use render::*; +pub static NEED_RENDER: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); diff --git a/yazi-shared/src/event/render.rs b/yazi-shared/src/event/render.rs deleted file mode 100644 index 5fa8fe5a..00000000 --- a/yazi-shared/src/event/render.rs +++ /dev/null @@ -1,27 +0,0 @@ -use std::sync::atomic::AtomicBool; - -pub static NEED_RENDER: AtomicBool = AtomicBool::new(false); - -#[macro_export] -macro_rules! render { - () => { - $crate::event::NEED_RENDER.store(true, std::sync::atomic::Ordering::Relaxed); - }; - ($cond:expr) => { - if $cond { - render!(); - } - }; -} - -#[macro_export] -macro_rules! render_and { - ($cond:expr) => { - if $cond { - render!(); - true - } else { - false - } - }; -} diff --git a/yazi-shared/src/fs/mod.rs b/yazi-shared/src/fs/mod.rs index 443aa0b1..b226c5c9 100644 --- a/yazi-shared/src/fs/mod.rs +++ b/yazi-shared/src/fs/mod.rs @@ -1,17 +1 @@ -mod cha; -mod file; -mod fns; -mod loc; -mod op; -mod path; -mod url; -mod urn; - -pub use cha::*; -pub use file::*; -pub use fns::*; -pub use loc::*; -pub use op::*; -pub use path::*; -pub use url::*; -pub use urn::*; +yazi_macro::mod_flat!(cha, file, fns, loc, op, path, url, urn); diff --git a/yazi-shared/src/fs/op.rs b/yazi-shared/src/fs/op.rs index 7883058c..d7c7721f 100644 --- a/yazi-shared/src/fs/op.rs +++ b/yazi-shared/src/fs/op.rs @@ -1,7 +1,7 @@ use std::{collections::{HashMap, HashSet}, sync::atomic::{AtomicU64, Ordering}}; use super::{Cha, File, UrnBuf}; -use crate::{Layer, emit, event::Cmd, fs::Url}; +use crate::{Layer, event::Cmd, fs::Url}; pub static FILES_TICKET: AtomicU64 = AtomicU64::new(0); @@ -38,7 +38,7 @@ impl FilesOp { #[inline] pub fn emit(self) { - emit!(Call(Cmd::new("update_files").with_any("op", self), Layer::Manager)); + crate::event::Event::Call(Cmd::new("update_files").with_any("op", self), Layer::Manager).emit(); } pub fn prepare(cwd: &Url) -> u64 { diff --git a/yazi-shared/src/lib.rs b/yazi-shared/src/lib.rs index 45eeed8b..77405a16 100644 --- a/yazi-shared/src/lib.rs +++ b/yazi-shared/src/lib.rs @@ -1,43 +1,11 @@ #![allow(clippy::option_map_unit_fn)] -mod chars; -mod condition; -mod debounce; -mod env; -mod errors; -pub mod event; -pub mod fs; -mod layer; -mod natsort; -mod number; -mod os; -mod rand; -mod ro_cell; -pub mod shell; -mod terminal; -pub mod theme; -mod throttle; -mod time; -mod translit; -mod xdg; +yazi_macro::mod_pub!(errors, event, fs, shell, theme, translit); -pub use chars::*; -pub use condition::*; -pub use debounce::*; -pub use env::*; -pub use errors::*; -pub use layer::*; -pub use natsort::*; -pub use number::*; -#[cfg(unix)] -pub use os::*; -pub use rand::*; -pub use ro_cell::*; -pub use terminal::*; -pub use throttle::*; -pub use time::*; -pub use translit::*; -pub use xdg::*; +yazi_macro::mod_flat!( + chars, condition, debounce, env, layer, natsort, number, os, rand, ro_cell, terminal, throttle, + time, xdg +); pub fn init() { #[cfg(unix)] diff --git a/yazi-shared/src/theme/mod.rs b/yazi-shared/src/theme/mod.rs index 97ccb2e1..2f544ac5 100644 --- a/yazi-shared/src/theme/mod.rs +++ b/yazi-shared/src/theme/mod.rs @@ -1,7 +1 @@ -mod color; -mod icon; -mod style; - -pub use color::*; -pub use icon::*; -pub use style::*; +yazi_macro::mod_flat!(color, icon, style); diff --git a/yazi-shared/src/translit/mod.rs b/yazi-shared/src/translit/mod.rs index a51cf385..26abf734 100644 --- a/yazi-shared/src/translit/mod.rs +++ b/yazi-shared/src/translit/mod.rs @@ -1,5 +1 @@ -mod table; -mod traits; - -use table::*; -pub use traits::*; +yazi_macro::mod_flat!(table, traits);