From 671b480ab19ee943fe01580ab77d26f1c53a037c 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: Sun, 22 Oct 2023 16:34:20 +0800 Subject: [PATCH] refactor: publish to crates.io (#298) --- .github/workflows/release.yml | 2 + .gitignore | 2 +- Cargo.lock | 238 +++++++++--------- Cargo.toml | 9 +- adaptor/Cargo.toml | 19 -- app/Cargo.toml | 33 --- cspell.json | 2 +- flake.nix | 2 +- plugin/Cargo.toml | 17 -- scripts/bump.sh | 1 + yazi-adaptor/Cargo.toml | 24 ++ {adaptor => yazi-adaptor}/src/adaptor.rs | 4 +- {adaptor => yazi-adaptor}/src/image.rs | 4 +- {adaptor => yazi-adaptor}/src/iterm2.rs | 2 +- {adaptor => yazi-adaptor}/src/kitty.rs | 2 +- {adaptor => yazi-adaptor}/src/lib.rs | 2 +- {adaptor => yazi-adaptor}/src/sixel.rs | 2 +- {adaptor => yazi-adaptor}/src/ueberzug.rs | 0 {config => yazi-config}/Cargo.toml | 13 +- {config => yazi-config}/build.rs | 7 +- {config => yazi-config}/preset/keymap.toml | 0 {config => yazi-config}/preset/theme.toml | 0 {config => yazi-config}/preset/yazi.toml | 0 {config => yazi-config}/src/boot/boot.rs | 2 +- {config => yazi-config}/src/boot/cli.rs | 0 {config => yazi-config}/src/boot/mod.rs | 0 {config => yazi-config}/src/keymap/control.rs | 0 {config => yazi-config}/src/keymap/exec.rs | 0 {config => yazi-config}/src/keymap/key.rs | 0 {config => yazi-config}/src/keymap/keymap.rs | 0 {config => yazi-config}/src/keymap/mod.rs | 0 {config => yazi-config}/src/lib.rs | 2 +- {config => yazi-config}/src/log/log.rs | 0 {config => yazi-config}/src/log/mod.rs | 0 {config => yazi-config}/src/manager/layout.rs | 2 +- .../src/manager/manager.rs | 0 {config => yazi-config}/src/manager/mod.rs | 0 .../src/manager/sorting.rs | 0 {config => yazi-config}/src/open/mod.rs | 0 {config => yazi-config}/src/open/open.rs | 2 +- {config => yazi-config}/src/open/opener.rs | 0 {config => yazi-config}/src/open/rule.rs | 0 {config => yazi-config}/src/pattern.rs | 0 {config => yazi-config}/src/plugins/mod.rs | 0 .../src/plugins/plugins.rs | 2 +- {config => yazi-config}/src/preset.rs | 0 {config => yazi-config}/src/preview/mod.rs | 0 .../src/preview/preview.rs | 2 +- {config => yazi-config}/src/tasks/mod.rs | 0 {config => yazi-config}/src/tasks/tasks.rs | 0 {config => yazi-config}/src/theme/color.rs | 0 {config => yazi-config}/src/theme/filetype.rs | 0 {config => yazi-config}/src/theme/icon.rs | 0 {config => yazi-config}/src/theme/mod.rs | 0 {config => yazi-config}/src/theme/style.rs | 0 {config => yazi-config}/src/theme/theme.rs | 2 +- {config => yazi-config}/src/validation.rs | 0 {config => yazi-config}/src/xdg.rs | 2 +- {core => yazi-core}/Cargo.toml | 17 +- {core => yazi-core}/src/blocker.rs | 2 +- {core => yazi-core}/src/context.rs | 4 +- {core => yazi-core}/src/event.rs | 4 +- {core => yazi-core}/src/external/clipboard.rs | 0 {core => yazi-core}/src/external/fd.rs | 2 +- .../src/external/ffmpegthumbnailer.rs | 4 +- {core => yazi-core}/src/external/file.rs | 2 +- {core => yazi-core}/src/external/fzf.rs | 2 +- {core => yazi-core}/src/external/jq.rs | 4 +- {core => yazi-core}/src/external/lsar.rs | 2 +- {core => yazi-core}/src/external/mod.rs | 0 {core => yazi-core}/src/external/pdftoppm.rs | 4 +- {core => yazi-core}/src/external/rg.rs | 2 +- {core => yazi-core}/src/external/shell.rs | 0 {core => yazi-core}/src/external/unar.rs | 0 {core => yazi-core}/src/external/zoxide.rs | 2 +- {core => yazi-core}/src/files/file.rs | 2 +- {core => yazi-core}/src/files/files.rs | 4 +- {core => yazi-core}/src/files/mod.rs | 0 {core => yazi-core}/src/files/op.rs | 2 +- {core => yazi-core}/src/files/sorter.rs | 4 +- {core => yazi-core}/src/help/help.rs | 4 +- {core => yazi-core}/src/help/mod.rs | 0 {core => yazi-core}/src/highlighter.rs | 2 +- {core => yazi-core}/src/input/input.rs | 4 +- {core => yazi-core}/src/input/mod.rs | 0 {core => yazi-core}/src/input/mode.rs | 0 {core => yazi-core}/src/input/op.rs | 0 {core => yazi-core}/src/input/option.rs | 0 {core => yazi-core}/src/input/shell.rs | 0 {core => yazi-core}/src/input/snap.rs | 0 {core => yazi-core}/src/input/snaps.rs | 0 {core => yazi-core}/src/lib.rs | 0 .../src/manager/commands/close.rs | 0 .../src/manager/commands/create.rs | 2 +- .../src/manager/commands/mod.rs | 0 .../src/manager/commands/open.rs | 4 +- .../src/manager/commands/peek.rs | 0 .../src/manager/commands/quit.rs | 0 .../src/manager/commands/refresh.rs | 0 .../src/manager/commands/rename.rs | 4 +- .../src/manager/commands/suspend.rs | 0 .../src/manager/commands/yank.rs | 0 {core => yazi-core}/src/manager/manager.rs | 2 +- {core => yazi-core}/src/manager/mod.rs | 0 {core => yazi-core}/src/manager/tabs.rs | 4 +- {core => yazi-core}/src/manager/watcher.rs | 2 +- {core => yazi-core}/src/position.rs | 0 {core => yazi-core}/src/preview/mod.rs | 0 {core => yazi-core}/src/preview/preview.rs | 6 +- {core => yazi-core}/src/preview/provider.rs | 6 +- {core => yazi-core}/src/select/mod.rs | 0 {core => yazi-core}/src/select/option.rs | 0 {core => yazi-core}/src/select/select.rs | 0 {core => yazi-core}/src/step.rs | 0 {core => yazi-core}/src/tab/backstack.rs | 0 {core => yazi-core}/src/tab/commands/arrow.rs | 0 .../src/tab/commands/backstack.rs | 0 {core => yazi-core}/src/tab/commands/cd.rs | 2 +- {core => yazi-core}/src/tab/commands/copy.rs | 0 {core => yazi-core}/src/tab/commands/enter.rs | 0 .../src/tab/commands/escape.rs | 2 +- {core => yazi-core}/src/tab/commands/find.rs | 4 +- .../src/tab/commands/hidden.rs | 2 +- {core => yazi-core}/src/tab/commands/jump.rs | 2 +- {core => yazi-core}/src/tab/commands/leave.rs | 0 .../src/tab/commands/linemode.rs | 2 +- {core => yazi-core}/src/tab/commands/mod.rs | 0 .../src/tab/commands/search.rs | 0 .../src/tab/commands/select.rs | 0 {core => yazi-core}/src/tab/commands/shell.rs | 2 +- {core => yazi-core}/src/tab/commands/sort.rs | 2 +- .../src/tab/commands/visual_mode.rs | 0 {core => yazi-core}/src/tab/config.rs | 2 +- {core => yazi-core}/src/tab/finder.rs | 2 +- {core => yazi-core}/src/tab/folder.rs | 4 +- {core => yazi-core}/src/tab/mod.rs | 0 {core => yazi-core}/src/tab/mode.rs | 0 {core => yazi-core}/src/tab/tab.rs | 2 +- {core => yazi-core}/src/tasks/mod.rs | 0 {core => yazi-core}/src/tasks/running.rs | 0 {core => yazi-core}/src/tasks/scheduler.rs | 4 +- {core => yazi-core}/src/tasks/task.rs | 0 {core => yazi-core}/src/tasks/tasks.rs | 4 +- {core => yazi-core}/src/tasks/workers/file.rs | 4 +- {core => yazi-core}/src/tasks/workers/mod.rs | 0 .../src/tasks/workers/precache.rs | 6 +- .../src/tasks/workers/process.rs | 0 {core => yazi-core}/src/which/mod.rs | 0 {core => yazi-core}/src/which/which.rs | 2 +- yazi-fm/Cargo.toml | 38 +++ {app => yazi-fm}/src/app.rs | 8 +- {app => yazi-fm}/src/executor.rs | 6 +- {app => yazi-fm}/src/help/bindings.rs | 4 +- {app => yazi-fm}/src/help/layout.rs | 4 +- {app => yazi-fm}/src/help/mod.rs | 0 {app => yazi-fm}/src/input/input.rs | 6 +- {app => yazi-fm}/src/input/mod.rs | 0 {app => yazi-fm}/src/logs.rs | 2 +- {app => yazi-fm}/src/main.rs | 8 +- {app => yazi-fm}/src/root.rs | 5 +- {app => yazi-fm}/src/select/mod.rs | 0 {app => yazi-fm}/src/select/select.rs | 4 +- {app => yazi-fm}/src/signals.rs | 2 +- {app => yazi-fm}/src/tasks/clear.rs | 0 {app => yazi-fm}/src/tasks/layout.rs | 4 +- {app => yazi-fm}/src/tasks/mod.rs | 0 {app => yazi-fm}/src/which/layout.rs | 4 +- {app => yazi-fm}/src/which/mod.rs | 0 {app => yazi-fm}/src/which/side.rs | 2 +- yazi-plugin/Cargo.toml | 22 ++ .../preset/components/folder.lua | 0 .../preset/components/header.lua | 0 .../preset/components/manager.lua | 0 .../preset/components/status.lua | 0 .../preset/inspect/LICENSE | 0 .../preset/inspect/inspect.lua | 0 {plugin => yazi-plugin}/preset/ui.lua | 0 {plugin => yazi-plugin}/preset/utils.lua | 0 .../src/bindings/active.rs | 27 +- .../src/bindings/bindings.rs | 0 {plugin => yazi-plugin}/src/bindings/files.rs | 57 ++--- {plugin => yazi-plugin}/src/bindings/mod.rs | 0 .../src/bindings/shared.rs | 6 +- {plugin => yazi-plugin}/src/bindings/tabs.rs | 16 +- {plugin => yazi-plugin}/src/bindings/tasks.rs | 6 +- .../src/components/base.rs | 2 +- .../src/components/components.rs | 4 +- .../src/components/folder.rs | 8 +- .../src/components/header.rs | 4 +- .../src/components/manager.rs | 4 +- {plugin => yazi-plugin}/src/components/mod.rs | 0 .../src/components/preview.rs | 2 +- .../src/components/status.rs | 4 +- {plugin => yazi-plugin}/src/config.rs | 25 +- {plugin => yazi-plugin}/src/layout/bar.rs | 0 {plugin => yazi-plugin}/src/layout/border.rs | 0 .../src/layout/constraint.rs | 0 {plugin => yazi-plugin}/src/layout/gauge.rs | 0 {plugin => yazi-plugin}/src/layout/layout.rs | 0 {plugin => yazi-plugin}/src/layout/line.rs | 0 {plugin => yazi-plugin}/src/layout/list.rs | 0 {plugin => yazi-plugin}/src/layout/mod.rs | 0 {plugin => yazi-plugin}/src/layout/padding.rs | 0 .../src/layout/paragraph.rs | 0 {plugin => yazi-plugin}/src/layout/rect.rs | 0 {plugin => yazi-plugin}/src/layout/span.rs | 2 +- {plugin => yazi-plugin}/src/layout/style.rs | 6 +- {plugin => yazi-plugin}/src/lib.rs | 0 {plugin => yazi-plugin}/src/plugin.rs | 4 +- {plugin => yazi-plugin}/src/scope.rs | 2 +- {plugin => yazi-plugin}/src/utils.rs | 0 {shared => yazi-shared}/Cargo.toml | 11 +- {shared => yazi-shared}/src/chars.rs | 0 {shared => yazi-shared}/src/debounce.rs | 0 {shared => yazi-shared}/src/defer.rs | 0 {shared => yazi-shared}/src/errors/input.rs | 0 {shared => yazi-shared}/src/errors/mod.rs | 0 {shared => yazi-shared}/src/errors/peek.rs | 0 {shared => yazi-shared}/src/fns.rs | 0 {shared => yazi-shared}/src/fs.rs | 0 {shared => yazi-shared}/src/lib.rs | 0 {shared => yazi-shared}/src/mime.rs | 0 {shared => yazi-shared}/src/natsort.rs | 0 {shared => yazi-shared}/src/ro_cell.rs | 0 {shared => yazi-shared}/src/term/cursor.rs | 0 {shared => yazi-shared}/src/term/mod.rs | 0 {shared => yazi-shared}/src/term/term.rs | 0 {shared => yazi-shared}/src/throttle.rs | 0 {shared => yazi-shared}/src/time.rs | 0 {shared => yazi-shared}/src/url.rs | 0 230 files changed, 442 insertions(+), 419 deletions(-) delete mode 100644 adaptor/Cargo.toml delete mode 100644 app/Cargo.toml delete mode 100644 plugin/Cargo.toml create mode 100644 yazi-adaptor/Cargo.toml rename {adaptor => yazi-adaptor}/src/adaptor.rs (98%) rename {adaptor => yazi-adaptor}/src/image.rs (97%) rename {adaptor => yazi-adaptor}/src/iterm2.rs (98%) rename {adaptor => yazi-adaptor}/src/kitty.rs (98%) rename {adaptor => yazi-adaptor}/src/lib.rs (96%) rename {adaptor => yazi-adaptor}/src/sixel.rs (99%) rename {adaptor => yazi-adaptor}/src/ueberzug.rs (100%) rename {config => yazi-config}/Cargo.toml (65%) rename {config => yazi-config}/build.rs (86%) rename {config => yazi-config}/preset/keymap.toml (100%) rename {config => yazi-config}/preset/theme.toml (100%) rename {config => yazi-config}/preset/yazi.toml (100%) rename {config => yazi-config}/src/boot/boot.rs (97%) rename {config => yazi-config}/src/boot/cli.rs (100%) rename {config => yazi-config}/src/boot/mod.rs (100%) rename {config => yazi-config}/src/keymap/control.rs (100%) rename {config => yazi-config}/src/keymap/exec.rs (100%) rename {config => yazi-config}/src/keymap/key.rs (100%) rename {config => yazi-config}/src/keymap/keymap.rs (100%) rename {config => yazi-config}/src/keymap/mod.rs (100%) rename {config => yazi-config}/src/lib.rs (98%) rename {config => yazi-config}/src/log/log.rs (100%) rename {config => yazi-config}/src/log/mod.rs (100%) rename {config => yazi-config}/src/manager/layout.rs (98%) rename {config => yazi-config}/src/manager/manager.rs (100%) rename {config => yazi-config}/src/manager/mod.rs (100%) rename {config => yazi-config}/src/manager/sorting.rs (100%) rename {config => yazi-config}/src/open/mod.rs (100%) rename {config => yazi-config}/src/open/open.rs (98%) rename {config => yazi-config}/src/open/opener.rs (100%) rename {config => yazi-config}/src/open/rule.rs (100%) rename {config => yazi-config}/src/pattern.rs (100%) rename {config => yazi-config}/src/plugins/mod.rs (100%) rename {config => yazi-config}/src/plugins/plugins.rs (94%) rename {config => yazi-config}/src/preset.rs (100%) rename {config => yazi-config}/src/preview/mod.rs (100%) rename {config => yazi-config}/src/preview/preview.rs (97%) rename {config => yazi-config}/src/tasks/mod.rs (100%) rename {config => yazi-config}/src/tasks/tasks.rs (100%) rename {config => yazi-config}/src/theme/color.rs (100%) rename {config => yazi-config}/src/theme/filetype.rs (100%) rename {config => yazi-config}/src/theme/icon.rs (100%) rename {config => yazi-config}/src/theme/mod.rs (100%) rename {config => yazi-config}/src/theme/style.rs (100%) rename {config => yazi-config}/src/theme/theme.rs (98%) rename {config => yazi-config}/src/validation.rs (100%) rename {config => yazi-config}/src/xdg.rs (96%) rename {core => yazi-core}/Cargo.toml (61%) rename {core => yazi-core}/src/blocker.rs (85%) rename {core => yazi-core}/src/context.rs (97%) rename {core => yazi-core}/src/event.rs (96%) rename {core => yazi-core}/src/external/clipboard.rs (100%) rename {core => yazi-core}/src/external/fd.rs (97%) rename {core => yazi-core}/src/external/ffmpegthumbnailer.rs (91%) rename {core => yazi-core}/src/external/file.rs (96%) rename {core => yazi-core}/src/external/fzf.rs (96%) rename {core => yazi-core}/src/external/jq.rs (94%) rename {core => yazi-core}/src/external/lsar.rs (98%) rename {core => yazi-core}/src/external/mod.rs (100%) rename {core => yazi-core}/src/external/pdftoppm.rs (93%) rename {core => yazi-core}/src/external/rg.rs (97%) rename {core => yazi-core}/src/external/shell.rs (100%) rename {core => yazi-core}/src/external/unar.rs (100%) rename {core => yazi-core}/src/external/zoxide.rs (97%) rename {core => yazi-core}/src/files/file.rs (98%) rename {core => yazi-core}/src/files/files.rs (99%) rename {core => yazi-core}/src/files/mod.rs (100%) rename {core => yazi-core}/src/files/op.rs (97%) rename {core => yazi-core}/src/files/sorter.rs (97%) rename {core => yazi-core}/src/help/help.rs (97%) rename {core => yazi-core}/src/help/mod.rs (100%) rename {core => yazi-core}/src/highlighter.rs (97%) rename {core => yazi-core}/src/input/input.rs (99%) rename {core => yazi-core}/src/input/mod.rs (100%) rename {core => yazi-core}/src/input/mode.rs (100%) rename {core => yazi-core}/src/input/op.rs (100%) rename {core => yazi-core}/src/input/option.rs (100%) rename {core => yazi-core}/src/input/shell.rs (100%) rename {core => yazi-core}/src/input/snap.rs (100%) rename {core => yazi-core}/src/input/snaps.rs (100%) rename {core => yazi-core}/src/lib.rs (100%) rename {core => yazi-core}/src/manager/commands/close.rs (100%) rename {core => yazi-core}/src/manager/commands/create.rs (98%) rename {core => yazi-core}/src/manager/commands/mod.rs (100%) rename {core => yazi-core}/src/manager/commands/open.rs (96%) rename {core => yazi-core}/src/manager/commands/peek.rs (100%) rename {core => yazi-core}/src/manager/commands/quit.rs (100%) rename {core => yazi-core}/src/manager/commands/refresh.rs (100%) rename {core => yazi-core}/src/manager/commands/rename.rs (98%) rename {core => yazi-core}/src/manager/commands/suspend.rs (100%) rename {core => yazi-core}/src/manager/commands/yank.rs (100%) rename {core => yazi-core}/src/manager/manager.rs (99%) rename {core => yazi-core}/src/manager/mod.rs (100%) rename {core => yazi-core}/src/manager/tabs.rs (97%) rename {core => yazi-core}/src/manager/watcher.rs (99%) rename {core => yazi-core}/src/position.rs (100%) rename {core => yazi-core}/src/preview/mod.rs (100%) rename {core => yazi-core}/src/preview/preview.rs (97%) rename {core => yazi-core}/src/preview/provider.rs (97%) rename {core => yazi-core}/src/select/mod.rs (100%) rename {core => yazi-core}/src/select/option.rs (100%) rename {core => yazi-core}/src/select/select.rs (100%) rename {core => yazi-core}/src/step.rs (100%) rename {core => yazi-core}/src/tab/backstack.rs (100%) rename {core => yazi-core}/src/tab/commands/arrow.rs (100%) rename {core => yazi-core}/src/tab/commands/backstack.rs (100%) rename {core => yazi-core}/src/tab/commands/cd.rs (98%) rename {core => yazi-core}/src/tab/commands/copy.rs (100%) rename {core => yazi-core}/src/tab/commands/enter.rs (100%) rename {core => yazi-core}/src/tab/commands/escape.rs (97%) rename {core => yazi-core}/src/tab/commands/find.rs (95%) rename {core => yazi-core}/src/tab/commands/hidden.rs (91%) rename {core => yazi-core}/src/tab/commands/jump.rs (95%) rename {core => yazi-core}/src/tab/commands/leave.rs (100%) rename {core => yazi-core}/src/tab/commands/linemode.rs (89%) rename {core => yazi-core}/src/tab/commands/mod.rs (100%) rename {core => yazi-core}/src/tab/commands/search.rs (100%) rename {core => yazi-core}/src/tab/commands/select.rs (100%) rename {core => yazi-core}/src/tab/commands/shell.rs (96%) rename {core => yazi-core}/src/tab/commands/sort.rs (89%) rename {core => yazi-core}/src/tab/commands/visual_mode.rs (100%) rename {core => yazi-core}/src/tab/config.rs (95%) rename {core => yazi-core}/src/tab/finder.rs (99%) rename {core => yazi-core}/src/tab/folder.rs (98%) rename {core => yazi-core}/src/tab/mod.rs (100%) rename {core => yazi-core}/src/tab/mode.rs (100%) rename {core => yazi-core}/src/tab/tab.rs (99%) rename {core => yazi-core}/src/tasks/mod.rs (100%) rename {core => yazi-core}/src/tasks/running.rs (100%) rename {core => yazi-core}/src/tasks/scheduler.rs (99%) rename {core => yazi-core}/src/tasks/task.rs (100%) rename {core => yazi-core}/src/tasks/tasks.rs (98%) rename {core => yazi-core}/src/tasks/workers/file.rs (98%) rename {core => yazi-core}/src/tasks/workers/mod.rs (100%) rename {core => yazi-core}/src/tasks/workers/precache.rs (97%) rename {core => yazi-core}/src/tasks/workers/process.rs (100%) rename {core => yazi-core}/src/which/mod.rs (100%) rename {core => yazi-core}/src/which/which.rs (95%) create mode 100644 yazi-fm/Cargo.toml rename {app => yazi-fm}/src/app.rs (96%) rename {app => yazi-fm}/src/executor.rs (97%) rename {app => yazi-fm}/src/help/bindings.rs (96%) rename {app => yazi-fm}/src/help/layout.rs (94%) rename {app => yazi-fm}/src/help/mod.rs (100%) rename {app => yazi-fm}/src/input/input.rs (94%) rename {app => yazi-fm}/src/input/mod.rs (100%) rename {app => yazi-fm}/src/logs.rs (96%) rename {app => yazi-fm}/src/main.rs (79%) rename {app => yazi-fm}/src/root.rs (95%) rename {app => yazi-fm}/src/select/mod.rs (100%) rename {app => yazi-fm}/src/select/select.rs (95%) rename {app => yazi-fm}/src/signals.rs (99%) rename {app => yazi-fm}/src/tasks/clear.rs (100%) rename {app => yazi-fm}/src/tasks/layout.rs (96%) rename {app => yazi-fm}/src/tasks/mod.rs (100%) rename {app => yazi-fm}/src/which/layout.rs (96%) rename {app => yazi-fm}/src/which/mod.rs (100%) rename {app => yazi-fm}/src/which/side.rs (96%) create mode 100644 yazi-plugin/Cargo.toml rename {plugin => yazi-plugin}/preset/components/folder.lua (100%) rename {plugin => yazi-plugin}/preset/components/header.lua (100%) rename {plugin => yazi-plugin}/preset/components/manager.lua (100%) rename {plugin => yazi-plugin}/preset/components/status.lua (100%) rename {plugin => yazi-plugin}/preset/inspect/LICENSE (100%) rename {plugin => yazi-plugin}/preset/inspect/inspect.lua (100%) rename {plugin => yazi-plugin}/preset/ui.lua (100%) rename {plugin => yazi-plugin}/preset/utils.lua (100%) rename {plugin => yazi-plugin}/src/bindings/active.rs (85%) rename {plugin => yazi-plugin}/src/bindings/bindings.rs (100%) rename {plugin => yazi-plugin}/src/bindings/files.rs (72%) rename {plugin => yazi-plugin}/src/bindings/mod.rs (100%) rename {plugin => yazi-plugin}/src/bindings/shared.rs (89%) rename {plugin => yazi-plugin}/src/bindings/tabs.rs (79%) rename {plugin => yazi-plugin}/src/bindings/tasks.rs (69%) rename {plugin => yazi-plugin}/src/components/base.rs (92%) rename {plugin => yazi-plugin}/src/components/components.rs (96%) rename {plugin => yazi-plugin}/src/components/folder.rs (70%) rename {plugin => yazi-plugin}/src/components/header.rs (84%) rename {plugin => yazi-plugin}/src/components/manager.rs (84%) rename {plugin => yazi-plugin}/src/components/mod.rs (100%) rename {plugin => yazi-plugin}/src/components/preview.rs (94%) rename {plugin => yazi-plugin}/src/components/status.rs (84%) rename {plugin => yazi-plugin}/src/config.rs (53%) rename {plugin => yazi-plugin}/src/layout/bar.rs (100%) rename {plugin => yazi-plugin}/src/layout/border.rs (100%) rename {plugin => yazi-plugin}/src/layout/constraint.rs (100%) rename {plugin => yazi-plugin}/src/layout/gauge.rs (100%) rename {plugin => yazi-plugin}/src/layout/layout.rs (100%) rename {plugin => yazi-plugin}/src/layout/line.rs (100%) rename {plugin => yazi-plugin}/src/layout/list.rs (100%) rename {plugin => yazi-plugin}/src/layout/mod.rs (100%) rename {plugin => yazi-plugin}/src/layout/padding.rs (100%) rename {plugin => yazi-plugin}/src/layout/paragraph.rs (100%) rename {plugin => yazi-plugin}/src/layout/rect.rs (100%) rename {plugin => yazi-plugin}/src/layout/span.rs (98%) rename {plugin => yazi-plugin}/src/layout/style.rs (95%) rename {plugin => yazi-plugin}/src/lib.rs (100%) rename {plugin => yazi-plugin}/src/plugin.rs (97%) rename {plugin => yazi-plugin}/src/scope.rs (95%) rename {plugin => yazi-plugin}/src/utils.rs (100%) rename {shared => yazi-shared}/Cargo.toml (51%) rename {shared => yazi-shared}/src/chars.rs (100%) rename {shared => yazi-shared}/src/debounce.rs (100%) rename {shared => yazi-shared}/src/defer.rs (100%) rename {shared => yazi-shared}/src/errors/input.rs (100%) rename {shared => yazi-shared}/src/errors/mod.rs (100%) rename {shared => yazi-shared}/src/errors/peek.rs (100%) rename {shared => yazi-shared}/src/fns.rs (100%) rename {shared => yazi-shared}/src/fs.rs (100%) rename {shared => yazi-shared}/src/lib.rs (100%) rename {shared => yazi-shared}/src/mime.rs (100%) rename {shared => yazi-shared}/src/natsort.rs (100%) rename {shared => yazi-shared}/src/ro_cell.rs (100%) rename {shared => yazi-shared}/src/term/cursor.rs (100%) rename {shared => yazi-shared}/src/term/mod.rs (100%) rename {shared => yazi-shared}/src/term/term.rs (100%) rename {shared => yazi-shared}/src/throttle.rs (100%) rename {shared => yazi-shared}/src/time.rs (100%) rename {shared => yazi-shared}/src/url.rs (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a89e66dd2..789da9e94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,8 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Build + env: + YAZI_GEN_COMPLETIONS: true run: cargo build --release --locked --target ${{ matrix.target }} - name: Pack artifacts [Linux & macOS] diff --git a/.gitignore b/.gitignore index 4a903a331..541fd1d9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ target/ -config/completions +yazi-config/completions .DS_Store diff --git a/Cargo.lock b/Cargo.lock index edf46a8e1..b16f035c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "adaptor" -version = "0.1.5" -dependencies = [ - "anyhow", - "base64", - "color_quant", - "config", - "image", - "ratatui", - "shared", - "tokio", - "tracing", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -121,29 +106,6 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" -[[package]] -name = "app" -version = "0.1.5" -dependencies = [ - "adaptor", - "ansi-to-tui", - "anyhow", - "config", - "core", - "crossterm", - "futures", - "libc", - "plugin", - "ratatui", - "shared", - "signal-hook-tokio", - "tokio", - "tracing", - "tracing-appender", - "tracing-subscriber", - "unicode-width", -] - [[package]] name = "async-channel" version = "1.9.0" @@ -386,58 +348,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "config" -version = "0.1.5" -dependencies = [ - "anyhow", - "clap", - "clap_complete", - "clap_complete_fig", - "clap_complete_nushell", - "crossterm", - "dirs", - "futures", - "glob", - "indexmap 2.0.2", - "md-5", - "ratatui", - "serde", - "shared", - "shell-words", - "toml", - "validator", -] - -[[package]] -name = "core" -version = "0.1.5" -dependencies = [ - "adaptor", - "anyhow", - "async-channel", - "clipboard-win", - "config", - "crossterm", - "futures", - "indexmap 2.0.2", - "libc", - "notify", - "parking_lot", - "ratatui", - "regex", - "serde", - "serde_json", - "shared", - "syntect", - "tokio", - "tokio-stream", - "tracing", - "trash", - "unicode-width", - "yazi-prebuild", -] - [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -1385,21 +1295,6 @@ dependencies = [ "time", ] -[[package]] -name = "plugin" -version = "0.1.5" -dependencies = [ - "ansi-to-tui", - "anyhow", - "config", - "core", - "mlua", - "ratatui", - "shared", - "tracing", - "unicode-width", -] - [[package]] name = "png" version = "0.17.10" @@ -1672,20 +1567,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared" -version = "0.1.5" -dependencies = [ - "anyhow", - "crossterm", - "futures", - "libc", - "parking_lot", - "ratatui", - "regex", - "tokio", -] - [[package]] name = "shell-words" version = "1.1.0" @@ -2483,6 +2364,111 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "yazi-adaptor" +version = "0.1.5" +dependencies = [ + "anyhow", + "base64", + "color_quant", + "image", + "ratatui", + "tokio", + "tracing", + "yazi-config", + "yazi-shared", +] + +[[package]] +name = "yazi-config" +version = "0.1.5" +dependencies = [ + "anyhow", + "clap", + "clap_complete", + "clap_complete_fig", + "clap_complete_nushell", + "crossterm", + "dirs", + "futures", + "glob", + "indexmap 2.0.2", + "md-5", + "ratatui", + "serde", + "shell-words", + "toml", + "validator", + "yazi-shared", +] + +[[package]] +name = "yazi-core" +version = "0.1.5" +dependencies = [ + "anyhow", + "async-channel", + "clipboard-win", + "crossterm", + "futures", + "indexmap 2.0.2", + "libc", + "notify", + "parking_lot", + "ratatui", + "regex", + "serde", + "serde_json", + "syntect", + "tokio", + "tokio-stream", + "tracing", + "trash", + "unicode-width", + "yazi-adaptor", + "yazi-config", + "yazi-prebuild", + "yazi-shared", +] + +[[package]] +name = "yazi-fm" +version = "0.1.5" +dependencies = [ + "ansi-to-tui", + "anyhow", + "crossterm", + "futures", + "libc", + "ratatui", + "signal-hook-tokio", + "tokio", + "tracing", + "tracing-appender", + "tracing-subscriber", + "unicode-width", + "yazi-adaptor", + "yazi-config", + "yazi-core", + "yazi-plugin", + "yazi-shared", +] + +[[package]] +name = "yazi-plugin" +version = "0.1.5" +dependencies = [ + "ansi-to-tui", + "anyhow", + "mlua", + "ratatui", + "tracing", + "unicode-width", + "yazi-config", + "yazi-core", + "yazi-shared", +] + [[package]] name = "yazi-prebuild" version = "0.1.0" @@ -2494,6 +2480,20 @@ dependencies = [ "walkdir", ] +[[package]] +name = "yazi-shared" +version = "0.1.5" +dependencies = [ + "anyhow", + "crossterm", + "futures", + "libc", + "parking_lot", + "ratatui", + "regex", + "tokio", +] + [[package]] name = "zune-inflate" version = "0.2.54" diff --git a/Cargo.toml b/Cargo.toml index e3d7df328..792aabab3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,6 @@ [workspace] resolver = "2" -members = [ - "adaptor", - "app", - "config", - "core", - "plugin", - "shared", -] +members = [ "yazi-*" ] [profile.release] lto = true diff --git a/adaptor/Cargo.toml b/adaptor/Cargo.toml deleted file mode 100644 index e1bd855b7..000000000 --- a/adaptor/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "adaptor" -version = "0.1.5" -edition = "2021" - -[dependencies] -config = { path = "../config" } -shared = { path = "../shared" } - -# External dependencies -anyhow = "^1" -base64 = "^0" -color_quant = "^1" -image = "^0" -ratatui = "^0" -tokio = { version = "^1", features = [ "parking_lot" ] } - -# Logging -tracing = "^0" diff --git a/app/Cargo.toml b/app/Cargo.toml deleted file mode 100644 index 4e98c40aa..000000000 --- a/app/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "app" -version = "0.1.5" -edition = "2021" - -[dependencies] -adaptor = { path = "../adaptor" } -config = { path = "../config" } -core = { path = "../core" } -plugin = { path = "../plugin" } -shared = { path = "../shared" } - -# External dependencies -ansi-to-tui = "^3" -anyhow = "^1" -crossterm = { version = "^0", features = [ "event-stream" ] } -futures = "^0" -ratatui = "^0" -tokio = { version = "^1", features = [ "parking_lot" ] } -unicode-width = "^0" - -# Logging -tracing = "^0" -tracing-appender = "^0" -tracing-subscriber = "^0" - -[target."cfg(unix)".dependencies] -libc = "^0" -signal-hook-tokio = { version = "^0", features = [ "futures-v0_3" ] } - -[[bin]] -name = "yazi" -path = "src/main.rs" diff --git a/cspell.json b/cspell.json index 0138e4fca..bd61a192c 100644 --- a/cspell.json +++ b/cspell.json @@ -1 +1 @@ -{"version":"0.2","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"],"flagWords":[]} +{"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell","msvc","aarch","linemode","sxyazi"],"language":"en","version":"0.2","flagWords":[]} diff --git a/flake.nix b/flake.nix index a5af39074..dec976185 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ let pkgs = import nixpkgs { inherit system overlays; }; versionSuffix = "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}"; - version = (builtins.fromTOML (builtins.readFile ./app/Cargo.toml)).package.version + versionSuffix; + version = (builtins.fromTOML (builtins.readFile ./yazi-fm/Cargo.toml)).package.version + versionSuffix; yazi = pkgs.callPackage ./nix/yazi.nix { inherit version; }; in { diff --git a/plugin/Cargo.toml b/plugin/Cargo.toml deleted file mode 100644 index fc262a7ad..000000000 --- a/plugin/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "plugin" -version = "0.1.5" -edition = "2021" - -[dependencies] -config = { path = "../config" } -core = { path = "../core" } -shared = { path = "../shared" } - -# External dependencies -ansi-to-tui = "^3" -anyhow = "^1" -mlua = { version = "^0", features = [ "luajit52", "vendored", "serialize" ] } -ratatui = "^0" -tracing = "^0" -unicode-width = "^0" diff --git a/scripts/bump.sh b/scripts/bump.sh index 4cc42a31b..a7a60a9e2 100755 --- a/scripts/bump.sh +++ b/scripts/bump.sh @@ -8,3 +8,4 @@ echo "Bumping version: $1" TOML_FILES="$(git ls-files '*Cargo.toml')" perl -pi -e "s/^version = .*\$/version = \"$1\"/" $TOML_FILES +perl -pi -e "s/^(yazi-[a-z]+)\\s*=\\s*{.*\$/\\1 = { path = \"..\/\\1\", version = \"$1\" }/" $TOML_FILES diff --git a/yazi-adaptor/Cargo.toml b/yazi-adaptor/Cargo.toml new file mode 100644 index 000000000..5e6b9c284 --- /dev/null +++ b/yazi-adaptor/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "yazi-adaptor" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi image adaptor" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" + +[dependencies] +yazi-config = { path = "../yazi-config", version = "0.1.5" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } + +# External dependencies +anyhow = "^1" +base64 = "^0" +color_quant = "^1" +image = "^0" +ratatui = "^0" +tokio = { version = "^1", features = [ "parking_lot", "io-util", "process" ] } + +# Logging +tracing = "^0" diff --git a/adaptor/src/adaptor.rs b/yazi-adaptor/src/adaptor.rs similarity index 98% rename from adaptor/src/adaptor.rs rename to yazi-adaptor/src/adaptor.rs index df651b893..2eac27ac7 100644 --- a/adaptor/src/adaptor.rs +++ b/yazi-adaptor/src/adaptor.rs @@ -1,10 +1,10 @@ use std::{env, path::{Path, PathBuf}, sync::atomic::{AtomicBool, Ordering}}; use anyhow::{anyhow, Result}; -use config::PREVIEW; +use yazi_config::PREVIEW; use ratatui::prelude::Rect; -use shared::RoCell; use tokio::{fs, sync::mpsc::UnboundedSender}; +use yazi_shared::RoCell; use super::{Iterm2, Kitty}; use crate::{ueberzug::Ueberzug, Sixel, TMUX}; diff --git a/adaptor/src/image.rs b/yazi-adaptor/src/image.rs similarity index 97% rename from adaptor/src/image.rs rename to yazi-adaptor/src/image.rs index b43803627..7ac7a87f0 100644 --- a/adaptor/src/image.rs +++ b/yazi-adaptor/src/image.rs @@ -1,10 +1,10 @@ use std::{path::Path, sync::Arc}; use anyhow::Result; -use config::PREVIEW; +use yazi_config::PREVIEW; use image::{imageops::FilterType, DynamicImage, ImageFormat}; -use shared::Term; use tokio::fs; +use yazi_shared::Term; pub struct Image; diff --git a/adaptor/src/iterm2.rs b/yazi-adaptor/src/iterm2.rs similarity index 98% rename from adaptor/src/iterm2.rs rename to yazi-adaptor/src/iterm2.rs index fc042e287..d419a9bca 100644 --- a/adaptor/src/iterm2.rs +++ b/yazi-adaptor/src/iterm2.rs @@ -4,7 +4,7 @@ use anyhow::Result; use base64::{engine::general_purpose, Engine}; use image::{codecs::jpeg::JpegEncoder, DynamicImage}; use ratatui::prelude::Rect; -use shared::Term; +use yazi_shared::Term; use super::image::Image; use crate::{CLOSE, START}; diff --git a/adaptor/src/kitty.rs b/yazi-adaptor/src/kitty.rs similarity index 98% rename from adaptor/src/kitty.rs rename to yazi-adaptor/src/kitty.rs index fbd2980f2..c66cb35e3 100644 --- a/adaptor/src/kitty.rs +++ b/yazi-adaptor/src/kitty.rs @@ -4,7 +4,7 @@ use anyhow::Result; use base64::{engine::general_purpose, Engine}; use image::DynamicImage; use ratatui::prelude::Rect; -use shared::Term; +use yazi_shared::Term; use super::image::Image; use crate::{CLOSE, ESCAPE, START}; diff --git a/adaptor/src/lib.rs b/yazi-adaptor/src/lib.rs similarity index 96% rename from adaptor/src/lib.rs rename to yazi-adaptor/src/lib.rs index 902f78fe7..668edb1df 100644 --- a/adaptor/src/lib.rs +++ b/yazi-adaptor/src/lib.rs @@ -10,8 +10,8 @@ mod ueberzug; use adaptor::*; use iterm2::*; use kitty::*; -use shared::RoCell; use sixel::*; +use yazi_shared::RoCell; pub use crate::image::*; diff --git a/adaptor/src/sixel.rs b/yazi-adaptor/src/sixel.rs similarity index 99% rename from adaptor/src/sixel.rs rename to yazi-adaptor/src/sixel.rs index fdf957bd5..7ec09ecee 100644 --- a/adaptor/src/sixel.rs +++ b/yazi-adaptor/src/sixel.rs @@ -4,7 +4,7 @@ use anyhow::{bail, Result}; use color_quant::NeuQuant; use image::DynamicImage; use ratatui::prelude::Rect; -use shared::Term; +use yazi_shared::Term; use crate::{Image, CLOSE, ESCAPE, START}; diff --git a/adaptor/src/ueberzug.rs b/yazi-adaptor/src/ueberzug.rs similarity index 100% rename from adaptor/src/ueberzug.rs rename to yazi-adaptor/src/ueberzug.rs diff --git a/config/Cargo.toml b/yazi-config/Cargo.toml similarity index 65% rename from config/Cargo.toml rename to yazi-config/Cargo.toml index 526db4d57..d4bd42095 100644 --- a/config/Cargo.toml +++ b/yazi-config/Cargo.toml @@ -1,10 +1,15 @@ [package] -name = "config" -version = "0.1.5" -edition = "2021" +name = "yazi-config" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi configuration file parser" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" [dependencies] -shared = { path = "../shared" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } # External dependencies anyhow = "^1" diff --git a/config/build.rs b/yazi-config/build.rs similarity index 86% rename from config/build.rs rename to yazi-config/build.rs index d34bdbbb9..c46a35b3e 100644 --- a/config/build.rs +++ b/yazi-config/build.rs @@ -1,12 +1,16 @@ #[path = "src/boot/cli.rs"] mod cli; -use std::{fs, io}; +use std::{env, fs, io}; use clap::CommandFactory; use clap_complete::{generate_to, Shell}; fn main() -> io::Result<()> { + if env::var_os("YAZI_GEN_COMPLETIONS").is_none() { + return Ok(()); + } + let cmd = &mut cli::Args::command(); let bin = "yazi"; let out = "completions"; @@ -19,6 +23,5 @@ fn main() -> io::Result<()> { generate_to(Shell::PowerShell, cmd, bin, out)?; generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?; generate_to(clap_complete_fig::Fig, cmd, bin, out)?; - Ok(()) } diff --git a/config/preset/keymap.toml b/yazi-config/preset/keymap.toml similarity index 100% rename from config/preset/keymap.toml rename to yazi-config/preset/keymap.toml diff --git a/config/preset/theme.toml b/yazi-config/preset/theme.toml similarity index 100% rename from config/preset/theme.toml rename to yazi-config/preset/theme.toml diff --git a/config/preset/yazi.toml b/yazi-config/preset/yazi.toml similarity index 100% rename from config/preset/yazi.toml rename to yazi-config/preset/yazi.toml diff --git a/config/src/boot/boot.rs b/yazi-config/src/boot/boot.rs similarity index 97% rename from config/src/boot/boot.rs rename to yazi-config/src/boot/boot.rs index 518103b70..bf6a882fd 100644 --- a/config/src/boot/boot.rs +++ b/yazi-config/src/boot/boot.rs @@ -1,7 +1,7 @@ use std::{env, fs, path::PathBuf, process}; use clap::Parser; -use shared::expand_path; +use yazi_shared::expand_path; use super::cli::Args; use crate::{Xdg, PREVIEW}; diff --git a/config/src/boot/cli.rs b/yazi-config/src/boot/cli.rs similarity index 100% rename from config/src/boot/cli.rs rename to yazi-config/src/boot/cli.rs diff --git a/config/src/boot/mod.rs b/yazi-config/src/boot/mod.rs similarity index 100% rename from config/src/boot/mod.rs rename to yazi-config/src/boot/mod.rs diff --git a/config/src/keymap/control.rs b/yazi-config/src/keymap/control.rs similarity index 100% rename from config/src/keymap/control.rs rename to yazi-config/src/keymap/control.rs diff --git a/config/src/keymap/exec.rs b/yazi-config/src/keymap/exec.rs similarity index 100% rename from config/src/keymap/exec.rs rename to yazi-config/src/keymap/exec.rs diff --git a/config/src/keymap/key.rs b/yazi-config/src/keymap/key.rs similarity index 100% rename from config/src/keymap/key.rs rename to yazi-config/src/keymap/key.rs diff --git a/config/src/keymap/keymap.rs b/yazi-config/src/keymap/keymap.rs similarity index 100% rename from config/src/keymap/keymap.rs rename to yazi-config/src/keymap/keymap.rs diff --git a/config/src/keymap/mod.rs b/yazi-config/src/keymap/mod.rs similarity index 100% rename from config/src/keymap/mod.rs rename to yazi-config/src/keymap/mod.rs diff --git a/config/src/lib.rs b/yazi-config/src/lib.rs similarity index 98% rename from config/src/lib.rs rename to yazi-config/src/lib.rs index 4d6e45a65..7baec5191 100644 --- a/config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -1,6 +1,6 @@ #![allow(clippy::module_inception)] -use shared::RoCell; +use yazi_shared::RoCell; mod boot; pub mod keymap; diff --git a/config/src/log/log.rs b/yazi-config/src/log/log.rs similarity index 100% rename from config/src/log/log.rs rename to yazi-config/src/log/log.rs diff --git a/config/src/log/mod.rs b/yazi-config/src/log/mod.rs similarity index 100% rename from config/src/log/mod.rs rename to yazi-config/src/log/mod.rs diff --git a/config/src/manager/layout.rs b/yazi-config/src/manager/layout.rs similarity index 98% rename from config/src/manager/layout.rs rename to yazi-config/src/manager/layout.rs index 3e95d3cb4..5e5a1e413 100644 --- a/config/src/manager/layout.rs +++ b/yazi-config/src/manager/layout.rs @@ -2,7 +2,7 @@ use anyhow::bail; use crossterm::terminal::WindowSize; use ratatui::{prelude::Rect, widgets::{Block, Padding}}; use serde::{Deserialize, Serialize}; -use shared::Term; +use yazi_shared::Term; use crate::THEME; diff --git a/config/src/manager/manager.rs b/yazi-config/src/manager/manager.rs similarity index 100% rename from config/src/manager/manager.rs rename to yazi-config/src/manager/manager.rs diff --git a/config/src/manager/mod.rs b/yazi-config/src/manager/mod.rs similarity index 100% rename from config/src/manager/mod.rs rename to yazi-config/src/manager/mod.rs diff --git a/config/src/manager/sorting.rs b/yazi-config/src/manager/sorting.rs similarity index 100% rename from config/src/manager/sorting.rs rename to yazi-config/src/manager/sorting.rs diff --git a/config/src/open/mod.rs b/yazi-config/src/open/mod.rs similarity index 100% rename from config/src/open/mod.rs rename to yazi-config/src/open/mod.rs diff --git a/config/src/open/open.rs b/yazi-config/src/open/open.rs similarity index 98% rename from config/src/open/open.rs rename to yazi-config/src/open/open.rs index 11a04f453..30d04237e 100644 --- a/config/src/open/open.rs +++ b/yazi-config/src/open/open.rs @@ -2,7 +2,7 @@ use std::{collections::BTreeMap, path::Path}; use indexmap::IndexSet; use serde::{Deserialize, Deserializer}; -use shared::MIME_DIR; +use yazi_shared::MIME_DIR; use super::Opener; use crate::{open::OpenRule, MERGED_YAZI}; diff --git a/config/src/open/opener.rs b/yazi-config/src/open/opener.rs similarity index 100% rename from config/src/open/opener.rs rename to yazi-config/src/open/opener.rs diff --git a/config/src/open/rule.rs b/yazi-config/src/open/rule.rs similarity index 100% rename from config/src/open/rule.rs rename to yazi-config/src/open/rule.rs diff --git a/config/src/pattern.rs b/yazi-config/src/pattern.rs similarity index 100% rename from config/src/pattern.rs rename to yazi-config/src/pattern.rs diff --git a/config/src/plugins/mod.rs b/yazi-config/src/plugins/mod.rs similarity index 100% rename from config/src/plugins/mod.rs rename to yazi-config/src/plugins/mod.rs diff --git a/config/src/plugins/plugins.rs b/yazi-config/src/plugins/plugins.rs similarity index 94% rename from config/src/plugins/plugins.rs rename to yazi-config/src/plugins/plugins.rs index 75da19882..1ff217a27 100644 --- a/config/src/plugins/plugins.rs +++ b/yazi-config/src/plugins/plugins.rs @@ -1,8 +1,8 @@ use std::path::PathBuf; use serde::Deserialize; -use shared::expand_path; use validator::Validate; +use yazi_shared::expand_path; use crate::MERGED_YAZI; diff --git a/config/src/preset.rs b/yazi-config/src/preset.rs similarity index 100% rename from config/src/preset.rs rename to yazi-config/src/preset.rs diff --git a/config/src/preview/mod.rs b/yazi-config/src/preview/mod.rs similarity index 100% rename from config/src/preview/mod.rs rename to yazi-config/src/preview/mod.rs diff --git a/config/src/preview/preview.rs b/yazi-config/src/preview/preview.rs similarity index 97% rename from config/src/preview/preview.rs rename to yazi-config/src/preview/preview.rs index 8d3818f8f..4484f1b07 100644 --- a/config/src/preview/preview.rs +++ b/yazi-config/src/preview/preview.rs @@ -2,7 +2,7 @@ use std::{path::{Path, PathBuf}, time::{self, SystemTime}}; use md5::{Digest, Md5}; use serde::Deserialize; -use shared::expand_path; +use yazi_shared::expand_path; use crate::{xdg::Xdg, MERGED_YAZI}; diff --git a/config/src/tasks/mod.rs b/yazi-config/src/tasks/mod.rs similarity index 100% rename from config/src/tasks/mod.rs rename to yazi-config/src/tasks/mod.rs diff --git a/config/src/tasks/tasks.rs b/yazi-config/src/tasks/tasks.rs similarity index 100% rename from config/src/tasks/tasks.rs rename to yazi-config/src/tasks/tasks.rs diff --git a/config/src/theme/color.rs b/yazi-config/src/theme/color.rs similarity index 100% rename from config/src/theme/color.rs rename to yazi-config/src/theme/color.rs diff --git a/config/src/theme/filetype.rs b/yazi-config/src/theme/filetype.rs similarity index 100% rename from config/src/theme/filetype.rs rename to yazi-config/src/theme/filetype.rs diff --git a/config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs similarity index 100% rename from config/src/theme/icon.rs rename to yazi-config/src/theme/icon.rs diff --git a/config/src/theme/mod.rs b/yazi-config/src/theme/mod.rs similarity index 100% rename from config/src/theme/mod.rs rename to yazi-config/src/theme/mod.rs diff --git a/config/src/theme/style.rs b/yazi-config/src/theme/style.rs similarity index 100% rename from config/src/theme/style.rs rename to yazi-config/src/theme/style.rs diff --git a/config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs similarity index 98% rename from config/src/theme/theme.rs rename to yazi-config/src/theme/theme.rs index f439e1ec6..dc1558b5e 100644 --- a/config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -1,8 +1,8 @@ use std::path::PathBuf; use serde::{Deserialize, Serialize}; -use shared::expand_path; use validator::Validate; +use yazi_shared::expand_path; use super::{Filetype, Icon, Style}; use crate::{validation::check_validation, MERGED_THEME}; diff --git a/config/src/validation.rs b/yazi-config/src/validation.rs similarity index 100% rename from config/src/validation.rs rename to yazi-config/src/validation.rs diff --git a/config/src/xdg.rs b/yazi-config/src/xdg.rs similarity index 96% rename from config/src/xdg.rs rename to yazi-config/src/xdg.rs index 005d6e0ce..bfeabfd97 100644 --- a/config/src/xdg.rs +++ b/yazi-config/src/xdg.rs @@ -1,6 +1,6 @@ use std::{env, path::PathBuf}; -use shared::expand_path; +use yazi_shared::expand_path; pub(super) struct Xdg; diff --git a/core/Cargo.toml b/yazi-core/Cargo.toml similarity index 61% rename from core/Cargo.toml rename to yazi-core/Cargo.toml index f0ba6e471..5c3b1db90 100644 --- a/core/Cargo.toml +++ b/yazi-core/Cargo.toml @@ -1,12 +1,17 @@ [package] -name = "core" -version = "0.1.5" -edition = "2021" +name = "yazi-core" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi core logic" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" [dependencies] -adaptor = { path = "../adaptor" } -config = { path = "../config" } -shared = { path = "../shared" } +yazi-adaptor = { path = "../yazi-adaptor", version = "0.1.5" } +yazi-config = { path = "../yazi-config", version = "0.1.5" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } # External dependencies anyhow = "^1" diff --git a/core/src/blocker.rs b/yazi-core/src/blocker.rs similarity index 85% rename from core/src/blocker.rs rename to yazi-core/src/blocker.rs index 7df45d8f5..ecd429b55 100644 --- a/core/src/blocker.rs +++ b/yazi-core/src/blocker.rs @@ -1,5 +1,5 @@ -use shared::RoCell; use tokio::sync::Semaphore; +use yazi_shared::RoCell; pub static BLOCKER: RoCell = RoCell::new(); diff --git a/core/src/context.rs b/yazi-core/src/context.rs similarity index 97% rename from core/src/context.rs rename to yazi-core/src/context.rs index 5bbaffda2..768258be2 100644 --- a/core/src/context.rs +++ b/yazi-core/src/context.rs @@ -1,7 +1,7 @@ -use config::keymap::KeymapLayer; +use yazi_config::keymap::KeymapLayer; use crossterm::terminal::WindowSize; use ratatui::prelude::Rect; -use shared::Term; +use yazi_shared::Term; use crate::{help::Help, input::Input, manager::Manager, select::Select, tasks::Tasks, which::Which, Position}; diff --git a/core/src/event.rs b/yazi-core/src/event.rs similarity index 96% rename from core/src/event.rs rename to yazi-core/src/event.rs index cc856c27c..5a7bd3bb9 100644 --- a/core/src/event.rs +++ b/yazi-core/src/event.rs @@ -1,10 +1,10 @@ use std::{collections::BTreeMap, ffi::OsString}; use anyhow::Result; -use config::{keymap::{Exec, KeymapLayer}, open::Opener}; +use yazi_config::{keymap::{Exec, KeymapLayer}, open::Opener}; use crossterm::event::KeyEvent; -use shared::{InputError, RoCell, Url}; use tokio::sync::{mpsc::{self, UnboundedSender}, oneshot}; +use yazi_shared::{InputError, RoCell, Url}; use super::{files::FilesOp, input::InputOpt, select::SelectOpt}; use crate::{preview::PreviewLock, tasks::TasksProgress}; diff --git a/core/src/external/clipboard.rs b/yazi-core/src/external/clipboard.rs similarity index 100% rename from core/src/external/clipboard.rs rename to yazi-core/src/external/clipboard.rs diff --git a/core/src/external/fd.rs b/yazi-core/src/external/fd.rs similarity index 97% rename from core/src/external/fd.rs rename to yazi-core/src/external/fd.rs index c1c606dbe..1d1fec645 100644 --- a/core/src/external/fd.rs +++ b/yazi-core/src/external/fd.rs @@ -1,8 +1,8 @@ use std::process::Stdio; use anyhow::Result; -use shared::Url; use tokio::{io::{AsyncBufReadExt, BufReader}, process::Command, sync::mpsc::{self, UnboundedReceiver}}; +use yazi_shared::Url; use crate::files::File; diff --git a/core/src/external/ffmpegthumbnailer.rs b/yazi-core/src/external/ffmpegthumbnailer.rs similarity index 91% rename from core/src/external/ffmpegthumbnailer.rs rename to yazi-core/src/external/ffmpegthumbnailer.rs index 98fbb6956..b1755ac33 100644 --- a/core/src/external/ffmpegthumbnailer.rs +++ b/yazi-core/src/external/ffmpegthumbnailer.rs @@ -1,8 +1,8 @@ use std::path::Path; -use config::PREVIEW; -use shared::PeekError; +use yazi_config::PREVIEW; use tokio::process::Command; +use yazi_shared::PeekError; pub async fn ffmpegthumbnailer(src: &Path, dest: &Path, skip: usize) -> Result<(), PeekError> { let percentage = 5 + skip; diff --git a/core/src/external/file.rs b/yazi-core/src/external/file.rs similarity index 96% rename from core/src/external/file.rs rename to yazi-core/src/external/file.rs index c48891f50..b4b61d164 100644 --- a/core/src/external/file.rs +++ b/yazi-core/src/external/file.rs @@ -2,9 +2,9 @@ use std::collections::BTreeMap; use anyhow::{bail, Result}; use futures::TryFutureExt; -use shared::{MimeKind, Url}; use tokio::process::Command; use tracing::error; +use yazi_shared::{MimeKind, Url}; async fn _file(files: &[&Url]) -> Result> { if files.is_empty() { diff --git a/core/src/external/fzf.rs b/yazi-core/src/external/fzf.rs similarity index 96% rename from core/src/external/fzf.rs rename to yazi-core/src/external/fzf.rs index 2c9dba77d..475367d9a 100644 --- a/core/src/external/fzf.rs +++ b/yazi-core/src/external/fzf.rs @@ -1,8 +1,8 @@ use std::process::Stdio; use anyhow::Result; -use shared::Url; use tokio::{process::Command, sync::oneshot::{self, Receiver}}; +use yazi_shared::Url; pub struct FzfOpt { pub cwd: Url, diff --git a/core/src/external/jq.rs b/yazi-core/src/external/jq.rs similarity index 94% rename from core/src/external/jq.rs rename to yazi-core/src/external/jq.rs index 0ca626a48..d37229e19 100644 --- a/core/src/external/jq.rs +++ b/yazi-core/src/external/jq.rs @@ -1,8 +1,8 @@ use std::{path::Path, process::Stdio}; use anyhow::Result; -use config::PREVIEW; -use shared::PeekError; +use yazi_config::PREVIEW; +use yazi_shared::PeekError; use tokio::{io::{AsyncBufReadExt, BufReader}, process::Command}; pub async fn jq(path: &Path, skip: usize, limit: usize) -> Result { diff --git a/core/src/external/lsar.rs b/yazi-core/src/external/lsar.rs similarity index 98% rename from core/src/external/lsar.rs rename to yazi-core/src/external/lsar.rs index 48eca6a97..19362fc5d 100644 --- a/core/src/external/lsar.rs +++ b/yazi-core/src/external/lsar.rs @@ -3,7 +3,7 @@ use std::path::Path; use anyhow::anyhow; use serde::Deserialize; use serde_json::Value; -use shared::PeekError; +use yazi_shared::PeekError; use tokio::process::Command; #[derive(Debug)] diff --git a/core/src/external/mod.rs b/yazi-core/src/external/mod.rs similarity index 100% rename from core/src/external/mod.rs rename to yazi-core/src/external/mod.rs diff --git a/core/src/external/pdftoppm.rs b/yazi-core/src/external/pdftoppm.rs similarity index 93% rename from core/src/external/pdftoppm.rs rename to yazi-core/src/external/pdftoppm.rs index 38b1ad860..ba71c45ed 100644 --- a/core/src/external/pdftoppm.rs +++ b/yazi-core/src/external/pdftoppm.rs @@ -1,8 +1,8 @@ use std::{path::Path, sync::Arc}; -use adaptor::Image; +use yazi_adaptor::Image; use regex::Regex; -use shared::PeekError; +use yazi_shared::PeekError; use tokio::process::Command; pub async fn pdftoppm(src: &Path, dest: impl AsRef, skip: usize) -> Result<(), PeekError> { diff --git a/core/src/external/rg.rs b/yazi-core/src/external/rg.rs similarity index 97% rename from core/src/external/rg.rs rename to yazi-core/src/external/rg.rs index 73114d508..96beb5ea5 100644 --- a/core/src/external/rg.rs +++ b/yazi-core/src/external/rg.rs @@ -1,7 +1,7 @@ use std::process::Stdio; use anyhow::Result; -use shared::Url; +use yazi_shared::Url; use tokio::{io::{AsyncBufReadExt, BufReader}, process::Command, sync::mpsc::{self, UnboundedReceiver}}; use crate::files::File; diff --git a/core/src/external/shell.rs b/yazi-core/src/external/shell.rs similarity index 100% rename from core/src/external/shell.rs rename to yazi-core/src/external/shell.rs diff --git a/core/src/external/unar.rs b/yazi-core/src/external/unar.rs similarity index 100% rename from core/src/external/unar.rs rename to yazi-core/src/external/unar.rs diff --git a/core/src/external/zoxide.rs b/yazi-core/src/external/zoxide.rs similarity index 97% rename from core/src/external/zoxide.rs rename to yazi-core/src/external/zoxide.rs index d947f1dd9..75e8f5d80 100644 --- a/core/src/external/zoxide.rs +++ b/yazi-core/src/external/zoxide.rs @@ -1,7 +1,7 @@ use std::process::Stdio; use anyhow::Result; -use shared::Url; +use yazi_shared::Url; use tokio::{process::Command, sync::oneshot::{self, Receiver}}; pub struct ZoxideOpt { diff --git a/core/src/files/file.rs b/yazi-core/src/files/file.rs similarity index 98% rename from core/src/files/file.rs rename to yazi-core/src/files/file.rs index 1c7cad5ee..3e5047c72 100644 --- a/core/src/files/file.rs +++ b/yazi-core/src/files/file.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, collections::BTreeMap, ffi::OsStr, fs::Metadata}; use anyhow::Result; -use shared::Url; +use yazi_shared::Url; use tokio::fs; #[derive(Clone, Debug)] diff --git a/core/src/files/files.rs b/yazi-core/src/files/files.rs similarity index 99% rename from core/src/files/files.rs rename to yazi-core/src/files/files.rs index 1b0e8490f..0fe03e43e 100644 --- a/core/src/files/files.rs +++ b/yazi-core/src/files/files.rs @@ -1,8 +1,8 @@ use std::{collections::{BTreeMap, BTreeSet}, mem, ops::Deref, sync::atomic::Ordering}; use anyhow::Result; -use config::{manager::SortBy, MANAGER}; -use shared::Url; +use yazi_config::{manager::SortBy, MANAGER}; +use yazi_shared::Url; use tokio::{fs, select, sync::mpsc::{self, UnboundedReceiver}}; use super::{File, FilesSorter, FILES_TICKET}; diff --git a/core/src/files/mod.rs b/yazi-core/src/files/mod.rs similarity index 100% rename from core/src/files/mod.rs rename to yazi-core/src/files/mod.rs diff --git a/core/src/files/op.rs b/yazi-core/src/files/op.rs similarity index 97% rename from core/src/files/op.rs rename to yazi-core/src/files/op.rs index 6854a6cc8..3337c16bc 100644 --- a/core/src/files/op.rs +++ b/yazi-core/src/files/op.rs @@ -1,6 +1,6 @@ use std::{collections::{BTreeMap, BTreeSet}, sync::atomic::{AtomicU64, Ordering}}; -use shared::Url; +use yazi_shared::Url; use super::File; use crate::emit; diff --git a/core/src/files/sorter.rs b/yazi-core/src/files/sorter.rs similarity index 97% rename from core/src/files/sorter.rs rename to yazi-core/src/files/sorter.rs index 21c1dea63..67436796b 100644 --- a/core/src/files/sorter.rs +++ b/yazi-core/src/files/sorter.rs @@ -1,7 +1,7 @@ use std::{cmp::Ordering, collections::BTreeMap, mem}; -use config::manager::SortBy; -use shared::{natsort, Url}; +use yazi_config::manager::SortBy; +use yazi_shared::{natsort, Url}; use super::File; diff --git a/core/src/help/help.rs b/yazi-core/src/help/help.rs similarity index 97% rename from core/src/help/help.rs rename to yazi-core/src/help/help.rs index 69d58e165..1ac1299ae 100644 --- a/core/src/help/help.rs +++ b/yazi-core/src/help/help.rs @@ -1,5 +1,5 @@ -use config::{keymap::{Control, Key, KeymapLayer}, KEYMAP}; -use shared::Term; +use yazi_config::{keymap::{Control, Key, KeymapLayer}, KEYMAP}; +use yazi_shared::Term; use unicode_width::UnicodeWidthStr; use super::HELP_MARGIN; diff --git a/core/src/help/mod.rs b/yazi-core/src/help/mod.rs similarity index 100% rename from core/src/help/mod.rs rename to yazi-core/src/help/mod.rs diff --git a/core/src/highlighter.rs b/yazi-core/src/highlighter.rs similarity index 97% rename from core/src/highlighter.rs rename to yazi-core/src/highlighter.rs index 1b91fdfe4..3e5d6db59 100644 --- a/core/src/highlighter.rs +++ b/yazi-core/src/highlighter.rs @@ -1,7 +1,7 @@ use std::{fs::File, io::BufReader, sync::OnceLock}; use anyhow::Result; -use config::THEME; +use yazi_config::THEME; use syntect::{dumps::from_uncompressed_data, highlighting::{Theme, ThemeSet}, parsing::SyntaxSet}; static SYNTECT_SYNTAX: OnceLock = OnceLock::new(); diff --git a/core/src/input/input.rs b/yazi-core/src/input/input.rs similarity index 99% rename from core/src/input/input.rs rename to yazi-core/src/input/input.rs index 143015eb5..6efccf1c8 100644 --- a/core/src/input/input.rs +++ b/yazi-core/src/input/input.rs @@ -1,8 +1,8 @@ use std::ops::Range; -use config::keymap::Key; +use yazi_config::keymap::Key; use crossterm::event::KeyCode; -use shared::{CharKind, InputError}; +use yazi_shared::{CharKind, InputError}; use tokio::sync::mpsc::UnboundedSender; use unicode_width::UnicodeWidthStr; diff --git a/core/src/input/mod.rs b/yazi-core/src/input/mod.rs similarity index 100% rename from core/src/input/mod.rs rename to yazi-core/src/input/mod.rs diff --git a/core/src/input/mode.rs b/yazi-core/src/input/mode.rs similarity index 100% rename from core/src/input/mode.rs rename to yazi-core/src/input/mode.rs diff --git a/core/src/input/op.rs b/yazi-core/src/input/op.rs similarity index 100% rename from core/src/input/op.rs rename to yazi-core/src/input/op.rs diff --git a/core/src/input/option.rs b/yazi-core/src/input/option.rs similarity index 100% rename from core/src/input/option.rs rename to yazi-core/src/input/option.rs diff --git a/core/src/input/shell.rs b/yazi-core/src/input/shell.rs similarity index 100% rename from core/src/input/shell.rs rename to yazi-core/src/input/shell.rs diff --git a/core/src/input/snap.rs b/yazi-core/src/input/snap.rs similarity index 100% rename from core/src/input/snap.rs rename to yazi-core/src/input/snap.rs diff --git a/core/src/input/snaps.rs b/yazi-core/src/input/snaps.rs similarity index 100% rename from core/src/input/snaps.rs rename to yazi-core/src/input/snaps.rs diff --git a/core/src/lib.rs b/yazi-core/src/lib.rs similarity index 100% rename from core/src/lib.rs rename to yazi-core/src/lib.rs diff --git a/core/src/manager/commands/close.rs b/yazi-core/src/manager/commands/close.rs similarity index 100% rename from core/src/manager/commands/close.rs rename to yazi-core/src/manager/commands/close.rs diff --git a/core/src/manager/commands/create.rs b/yazi-core/src/manager/commands/create.rs similarity index 98% rename from core/src/manager/commands/create.rs rename to yazi-core/src/manager/commands/create.rs index e0406c865..275455b6f 100644 --- a/core/src/manager/commands/create.rs +++ b/yazi-core/src/manager/commands/create.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use shared::Url; +use yazi_shared::Url; use tokio::fs::{self}; use crate::{emit, files::{File, FilesOp}, input::InputOpt, manager::Manager}; diff --git a/core/src/manager/commands/mod.rs b/yazi-core/src/manager/commands/mod.rs similarity index 100% rename from core/src/manager/commands/mod.rs rename to yazi-core/src/manager/commands/mod.rs diff --git a/core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs similarity index 96% rename from core/src/manager/commands/open.rs rename to yazi-core/src/manager/commands/open.rs index e1c7aa774..eb860454c 100644 --- a/core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -1,5 +1,5 @@ -use config::OPEN; -use shared::MIME_DIR; +use yazi_config::OPEN; +use yazi_shared::MIME_DIR; use crate::{emit, external, manager::Manager, select::SelectOpt}; diff --git a/core/src/manager/commands/peek.rs b/yazi-core/src/manager/commands/peek.rs similarity index 100% rename from core/src/manager/commands/peek.rs rename to yazi-core/src/manager/commands/peek.rs diff --git a/core/src/manager/commands/quit.rs b/yazi-core/src/manager/commands/quit.rs similarity index 100% rename from core/src/manager/commands/quit.rs rename to yazi-core/src/manager/commands/quit.rs diff --git a/core/src/manager/commands/refresh.rs b/yazi-core/src/manager/commands/refresh.rs similarity index 100% rename from core/src/manager/commands/refresh.rs rename to yazi-core/src/manager/commands/refresh.rs diff --git a/core/src/manager/commands/rename.rs b/yazi-core/src/manager/commands/rename.rs similarity index 98% rename from core/src/manager/commands/rename.rs rename to yazi-core/src/manager/commands/rename.rs index cc6da3713..8867bfb9e 100644 --- a/core/src/manager/commands/rename.rs +++ b/yazi-core/src/manager/commands/rename.rs @@ -1,8 +1,8 @@ use std::{collections::BTreeSet, ffi::OsStr, io::{stdout, BufWriter, Write}, path::PathBuf}; use anyhow::{anyhow, bail, Result}; -use config::{OPEN, PREVIEW}; -use shared::{max_common_root, Defer, Term, Url}; +use yazi_config::{OPEN, PREVIEW}; +use yazi_shared::{max_common_root, Defer, Term, Url}; use tokio::{fs::{self, OpenOptions}, io::{stdin, AsyncReadExt, AsyncWriteExt}}; use crate::{emit, external::{self, ShellOpt}, files::{File, FilesOp}, input::InputOpt, manager::Manager, Event, BLOCKER}; diff --git a/core/src/manager/commands/suspend.rs b/yazi-core/src/manager/commands/suspend.rs similarity index 100% rename from core/src/manager/commands/suspend.rs rename to yazi-core/src/manager/commands/suspend.rs diff --git a/core/src/manager/commands/yank.rs b/yazi-core/src/manager/commands/yank.rs similarity index 100% rename from core/src/manager/commands/yank.rs rename to yazi-core/src/manager/commands/yank.rs diff --git a/core/src/manager/manager.rs b/yazi-core/src/manager/manager.rs similarity index 99% rename from core/src/manager/manager.rs rename to yazi-core/src/manager/manager.rs index d661aeeb4..eafb7b3ff 100644 --- a/core/src/manager/manager.rs +++ b/yazi-core/src/manager/manager.rs @@ -1,6 +1,6 @@ use std::collections::{BTreeMap, HashMap, HashSet}; -use shared::Url; +use yazi_shared::Url; use super::{Tabs, Watcher}; use crate::{emit, files::{File, FilesOp}, tab::{Folder, Tab}, tasks::Tasks}; diff --git a/core/src/manager/mod.rs b/yazi-core/src/manager/mod.rs similarity index 100% rename from core/src/manager/mod.rs rename to yazi-core/src/manager/mod.rs diff --git a/core/src/manager/tabs.rs b/yazi-core/src/manager/tabs.rs similarity index 97% rename from core/src/manager/tabs.rs rename to yazi-core/src/manager/tabs.rs index 02a813152..edaf178d8 100644 --- a/core/src/manager/tabs.rs +++ b/yazi-core/src/manager/tabs.rs @@ -1,5 +1,5 @@ -use config::BOOT; -use shared::Url; +use yazi_config::BOOT; +use yazi_shared::Url; use crate::{emit, tab::Tab}; diff --git a/core/src/manager/watcher.rs b/yazi-core/src/manager/watcher.rs similarity index 99% rename from core/src/manager/watcher.rs rename to yazi-core/src/manager/watcher.rs index 549089318..b1671fb8e 100644 --- a/core/src/manager/watcher.rs +++ b/yazi-core/src/manager/watcher.rs @@ -3,7 +3,7 @@ use std::{collections::BTreeSet, sync::Arc, time::Duration}; use indexmap::IndexMap; use notify::{event::{MetadataKind, ModifyKind}, EventKind, RecommendedWatcher, RecursiveMode, Watcher as _Watcher}; use parking_lot::RwLock; -use shared::Url; +use yazi_shared::Url; use tokio::{fs, pin, sync::mpsc::{self, UnboundedReceiver}}; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; diff --git a/core/src/position.rs b/yazi-core/src/position.rs similarity index 100% rename from core/src/position.rs rename to yazi-core/src/position.rs diff --git a/core/src/preview/mod.rs b/yazi-core/src/preview/mod.rs similarity index 100% rename from core/src/preview/mod.rs rename to yazi-core/src/preview/mod.rs diff --git a/core/src/preview/preview.rs b/yazi-core/src/preview/preview.rs similarity index 97% rename from core/src/preview/preview.rs rename to yazi-core/src/preview/preview.rs index 97ac9d702..5b94a6c87 100644 --- a/core/src/preview/preview.rs +++ b/yazi-core/src/preview/preview.rs @@ -1,8 +1,8 @@ use std::{sync::atomic::Ordering, time::Duration}; -use adaptor::ADAPTOR; -use config::MANAGER; -use shared::{MimeKind, PeekError, Url, MIME_DIR}; +use yazi_adaptor::ADAPTOR; +use yazi_config::MANAGER; +use yazi_shared::{MimeKind, PeekError, Url, MIME_DIR}; use tokio::{pin, task::JoinHandle}; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; diff --git a/core/src/preview/provider.rs b/yazi-core/src/preview/provider.rs similarity index 97% rename from core/src/preview/provider.rs rename to yazi-core/src/preview/provider.rs index 3271b0ae5..e024bc7c3 100644 --- a/core/src/preview/provider.rs +++ b/yazi-core/src/preview/provider.rs @@ -1,10 +1,10 @@ use std::{io::BufRead, path::Path, sync::atomic::{AtomicUsize, Ordering}}; -use adaptor::ADAPTOR; +use yazi_adaptor::ADAPTOR; use anyhow::anyhow; -use config::{MANAGER, PREVIEW}; +use yazi_config::{MANAGER, PREVIEW}; use futures::TryFutureExt; -use shared::{MimeKind, PeekError}; +use yazi_shared::{MimeKind, PeekError}; use syntect::{easy::HighlightFile, util::as_24_bit_terminal_escaped}; use tokio::fs; diff --git a/core/src/select/mod.rs b/yazi-core/src/select/mod.rs similarity index 100% rename from core/src/select/mod.rs rename to yazi-core/src/select/mod.rs diff --git a/core/src/select/option.rs b/yazi-core/src/select/option.rs similarity index 100% rename from core/src/select/option.rs rename to yazi-core/src/select/option.rs diff --git a/core/src/select/select.rs b/yazi-core/src/select/select.rs similarity index 100% rename from core/src/select/select.rs rename to yazi-core/src/select/select.rs diff --git a/core/src/step.rs b/yazi-core/src/step.rs similarity index 100% rename from core/src/step.rs rename to yazi-core/src/step.rs diff --git a/core/src/tab/backstack.rs b/yazi-core/src/tab/backstack.rs similarity index 100% rename from core/src/tab/backstack.rs rename to yazi-core/src/tab/backstack.rs diff --git a/core/src/tab/commands/arrow.rs b/yazi-core/src/tab/commands/arrow.rs similarity index 100% rename from core/src/tab/commands/arrow.rs rename to yazi-core/src/tab/commands/arrow.rs diff --git a/core/src/tab/commands/backstack.rs b/yazi-core/src/tab/commands/backstack.rs similarity index 100% rename from core/src/tab/commands/backstack.rs rename to yazi-core/src/tab/commands/backstack.rs diff --git a/core/src/tab/commands/cd.rs b/yazi-core/src/tab/commands/cd.rs similarity index 98% rename from core/src/tab/commands/cd.rs rename to yazi-core/src/tab/commands/cd.rs index d73e94098..90ec23884 100644 --- a/core/src/tab/commands/cd.rs +++ b/yazi-core/src/tab/commands/cd.rs @@ -1,6 +1,6 @@ use std::mem; -use shared::Url; +use yazi_shared::Url; use crate::{emit, files::{File, FilesOp}, input::InputOpt, tab::Tab}; diff --git a/core/src/tab/commands/copy.rs b/yazi-core/src/tab/commands/copy.rs similarity index 100% rename from core/src/tab/commands/copy.rs rename to yazi-core/src/tab/commands/copy.rs diff --git a/core/src/tab/commands/enter.rs b/yazi-core/src/tab/commands/enter.rs similarity index 100% rename from core/src/tab/commands/enter.rs rename to yazi-core/src/tab/commands/enter.rs diff --git a/core/src/tab/commands/escape.rs b/yazi-core/src/tab/commands/escape.rs similarity index 97% rename from core/src/tab/commands/escape.rs rename to yazi-core/src/tab/commands/escape.rs index b77747a8f..3d0738083 100644 --- a/core/src/tab/commands/escape.rs +++ b/yazi-core/src/tab/commands/escape.rs @@ -1,4 +1,4 @@ -use config::keymap::Exec; +use yazi_config::keymap::Exec; use crate::tab::{Mode, Tab}; diff --git a/core/src/tab/commands/find.rs b/yazi-core/src/tab/commands/find.rs similarity index 95% rename from core/src/tab/commands/find.rs rename to yazi-core/src/tab/commands/find.rs index 2a9b9381d..d197ff36d 100644 --- a/core/src/tab/commands/find.rs +++ b/yazi-core/src/tab/commands/find.rs @@ -1,7 +1,7 @@ use std::time::Duration; -use config::keymap::{Exec, KeymapLayer}; -use shared::{Debounce, InputError}; +use yazi_config::keymap::{Exec, KeymapLayer}; +use yazi_shared::{Debounce, InputError}; use tokio::pin; use tokio_stream::{wrappers::UnboundedReceiverStream, StreamExt}; diff --git a/core/src/tab/commands/hidden.rs b/yazi-core/src/tab/commands/hidden.rs similarity index 91% rename from core/src/tab/commands/hidden.rs rename to yazi-core/src/tab/commands/hidden.rs index bf2a289ae..8770f98b2 100644 --- a/core/src/tab/commands/hidden.rs +++ b/yazi-core/src/tab/commands/hidden.rs @@ -1,4 +1,4 @@ -use config::keymap::Exec; +use yazi_config::keymap::Exec; use crate::{emit, tab::Tab}; diff --git a/core/src/tab/commands/jump.rs b/yazi-core/src/tab/commands/jump.rs similarity index 95% rename from core/src/tab/commands/jump.rs rename to yazi-core/src/tab/commands/jump.rs index 02778eccf..58297e192 100644 --- a/core/src/tab/commands/jump.rs +++ b/yazi-core/src/tab/commands/jump.rs @@ -1,4 +1,4 @@ -use shared::Defer; +use yazi_shared::Defer; use crate::{emit, external::{self, FzfOpt, ZoxideOpt}, tab::Tab, Event, BLOCKER}; diff --git a/core/src/tab/commands/leave.rs b/yazi-core/src/tab/commands/leave.rs similarity index 100% rename from core/src/tab/commands/leave.rs rename to yazi-core/src/tab/commands/leave.rs diff --git a/core/src/tab/commands/linemode.rs b/yazi-core/src/tab/commands/linemode.rs similarity index 89% rename from core/src/tab/commands/linemode.rs rename to yazi-core/src/tab/commands/linemode.rs index bd8c82338..f54f737f8 100644 --- a/core/src/tab/commands/linemode.rs +++ b/yazi-core/src/tab/commands/linemode.rs @@ -1,4 +1,4 @@ -use config::keymap::Exec; +use yazi_config::keymap::Exec; use crate::tab::Tab; diff --git a/core/src/tab/commands/mod.rs b/yazi-core/src/tab/commands/mod.rs similarity index 100% rename from core/src/tab/commands/mod.rs rename to yazi-core/src/tab/commands/mod.rs diff --git a/core/src/tab/commands/search.rs b/yazi-core/src/tab/commands/search.rs similarity index 100% rename from core/src/tab/commands/search.rs rename to yazi-core/src/tab/commands/search.rs diff --git a/core/src/tab/commands/select.rs b/yazi-core/src/tab/commands/select.rs similarity index 100% rename from core/src/tab/commands/select.rs rename to yazi-core/src/tab/commands/select.rs diff --git a/core/src/tab/commands/shell.rs b/yazi-core/src/tab/commands/shell.rs similarity index 96% rename from core/src/tab/commands/shell.rs rename to yazi-core/src/tab/commands/shell.rs index ffcc9a7bc..98a39c67e 100644 --- a/core/src/tab/commands/shell.rs +++ b/yazi-core/src/tab/commands/shell.rs @@ -1,4 +1,4 @@ -use config::open::Opener; +use yazi_config::open::Opener; use crate::{emit, input::InputOpt, tab::Tab}; diff --git a/core/src/tab/commands/sort.rs b/yazi-core/src/tab/commands/sort.rs similarity index 89% rename from core/src/tab/commands/sort.rs rename to yazi-core/src/tab/commands/sort.rs index 8683d5125..ea430bdb5 100644 --- a/core/src/tab/commands/sort.rs +++ b/yazi-core/src/tab/commands/sort.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use config::{keymap::Exec, manager::SortBy}; +use yazi_config::{keymap::Exec, manager::SortBy}; use crate::tab::Tab; diff --git a/core/src/tab/commands/visual_mode.rs b/yazi-core/src/tab/commands/visual_mode.rs similarity index 100% rename from core/src/tab/commands/visual_mode.rs rename to yazi-core/src/tab/commands/visual_mode.rs diff --git a/core/src/tab/config.rs b/yazi-core/src/tab/config.rs similarity index 95% rename from core/src/tab/config.rs rename to yazi-core/src/tab/config.rs index 6c0a900a7..5f6f11d23 100644 --- a/core/src/tab/config.rs +++ b/yazi-core/src/tab/config.rs @@ -1,4 +1,4 @@ -use config::{manager::SortBy, MANAGER}; +use yazi_config::{manager::SortBy, MANAGER}; use crate::files::FilesSorter; diff --git a/core/src/tab/finder.rs b/yazi-core/src/tab/finder.rs similarity index 99% rename from core/src/tab/finder.rs rename to yazi-core/src/tab/finder.rs index d9e829dfc..0e297d27b 100644 --- a/core/src/tab/finder.rs +++ b/yazi-core/src/tab/finder.rs @@ -2,7 +2,7 @@ use std::{collections::BTreeMap, ffi::OsStr, ops::Range}; use anyhow::Result; use regex::bytes::{Regex, RegexBuilder}; -use shared::Url; +use yazi_shared::Url; use crate::files::Files; diff --git a/core/src/tab/folder.rs b/yazi-core/src/tab/folder.rs similarity index 98% rename from core/src/tab/folder.rs rename to yazi-core/src/tab/folder.rs index f60c8bcac..6d7a061e1 100644 --- a/core/src/tab/folder.rs +++ b/yazi-core/src/tab/folder.rs @@ -1,6 +1,6 @@ -use config::MANAGER; +use yazi_config::MANAGER; use ratatui::layout::Rect; -use shared::Url; +use yazi_shared::Url; use crate::{emit, files::{File, Files, FilesOp}, Step}; diff --git a/core/src/tab/mod.rs b/yazi-core/src/tab/mod.rs similarity index 100% rename from core/src/tab/mod.rs rename to yazi-core/src/tab/mod.rs diff --git a/core/src/tab/mode.rs b/yazi-core/src/tab/mode.rs similarity index 100% rename from core/src/tab/mode.rs rename to yazi-core/src/tab/mode.rs diff --git a/core/src/tab/tab.rs b/yazi-core/src/tab/tab.rs similarity index 99% rename from core/src/tab/tab.rs rename to yazi-core/src/tab/tab.rs index 0d6770b01..0ba7a954a 100644 --- a/core/src/tab/tab.rs +++ b/yazi-core/src/tab/tab.rs @@ -1,8 +1,8 @@ use std::{borrow::Cow, collections::BTreeMap}; use anyhow::Result; -use shared::Url; use tokio::task::JoinHandle; +use yazi_shared::Url; use super::{Backstack, Config, Finder, Folder, Mode}; use crate::{files::File, preview::{Preview, PreviewLock}}; diff --git a/core/src/tasks/mod.rs b/yazi-core/src/tasks/mod.rs similarity index 100% rename from core/src/tasks/mod.rs rename to yazi-core/src/tasks/mod.rs diff --git a/core/src/tasks/running.rs b/yazi-core/src/tasks/running.rs similarity index 100% rename from core/src/tasks/running.rs rename to yazi-core/src/tasks/running.rs diff --git a/core/src/tasks/scheduler.rs b/yazi-core/src/tasks/scheduler.rs similarity index 99% rename from core/src/tasks/scheduler.rs rename to yazi-core/src/tasks/scheduler.rs index 3d4e650aa..c1ba7833c 100644 --- a/core/src/tasks/scheduler.rs +++ b/yazi-core/src/tasks/scheduler.rs @@ -1,9 +1,9 @@ use std::{ffi::OsStr, sync::Arc, time::Duration}; -use config::{open::Opener, TASKS}; +use yazi_config::{open::Opener, TASKS}; use futures::{future::BoxFuture, FutureExt}; use parking_lot::RwLock; -use shared::{unique_path, Throttle, Url}; +use yazi_shared::{unique_path, Throttle, Url}; use tokio::{fs, select, sync::{mpsc::{self, UnboundedReceiver}, oneshot}, time::sleep}; use super::{workers::{File, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash, Precache, PrecacheOpMime, PrecacheOpSize, Process, ProcessOpOpen}, Running, TaskOp, TaskStage, TasksProgress}; diff --git a/core/src/tasks/task.rs b/yazi-core/src/tasks/task.rs similarity index 100% rename from core/src/tasks/task.rs rename to yazi-core/src/tasks/task.rs diff --git a/core/src/tasks/tasks.rs b/yazi-core/src/tasks/tasks.rs similarity index 98% rename from core/src/tasks/tasks.rs rename to yazi-core/src/tasks/tasks.rs index 3b7682e83..43d42c22d 100644 --- a/core/src/tasks/tasks.rs +++ b/yazi-core/src/tasks/tasks.rs @@ -1,9 +1,9 @@ use std::{collections::{BTreeMap, HashMap, HashSet}, ffi::OsStr, io::{stdout, Write}, path::Path, sync::Arc}; -use config::{manager::SortBy, open::Opener, OPEN}; +use yazi_config::{manager::SortBy, open::Opener, OPEN}; use crossterm::terminal::{disable_raw_mode, enable_raw_mode}; use serde::Serialize; -use shared::{Defer, MimeKind, Term, Url}; +use yazi_shared::{Defer, MimeKind, Term, Url}; use tokio::{io::{stdin, AsyncReadExt}, select, sync::mpsc, time}; use tracing::trace; diff --git a/core/src/tasks/workers/file.rs b/yazi-core/src/tasks/workers/file.rs similarity index 98% rename from core/src/tasks/workers/file.rs rename to yazi-core/src/tasks/workers/file.rs index 86982a9a2..4f545a1e7 100644 --- a/core/src/tasks/workers/file.rs +++ b/yazi-core/src/tasks/workers/file.rs @@ -1,9 +1,9 @@ use std::{borrow::Cow, collections::VecDeque, fs::Metadata, path::{Path, PathBuf}}; use anyhow::Result; -use config::TASKS; +use yazi_config::TASKS; use futures::{future::BoxFuture, FutureExt}; -use shared::{calculate_size, copy_with_progress, path_relative_to, Url}; +use yazi_shared::{calculate_size, copy_with_progress, path_relative_to, Url}; use tokio::{fs, io::{self, ErrorKind::{AlreadyExists, NotFound}}, sync::mpsc}; use tracing::trace; diff --git a/core/src/tasks/workers/mod.rs b/yazi-core/src/tasks/workers/mod.rs similarity index 100% rename from core/src/tasks/workers/mod.rs rename to yazi-core/src/tasks/workers/mod.rs diff --git a/core/src/tasks/workers/precache.rs b/yazi-core/src/tasks/workers/precache.rs similarity index 97% rename from core/src/tasks/workers/precache.rs rename to yazi-core/src/tasks/workers/precache.rs index c63a9abc7..35fcc2644 100644 --- a/core/src/tasks/workers/precache.rs +++ b/yazi-core/src/tasks/workers/precache.rs @@ -1,10 +1,10 @@ use std::{collections::{BTreeMap, BTreeSet}, sync::Arc}; -use adaptor::Image; +use yazi_adaptor::Image; use anyhow::Result; -use config::PREVIEW; +use yazi_config::PREVIEW; use parking_lot::Mutex; -use shared::{calculate_size, Throttle, Url}; +use yazi_shared::{calculate_size, Throttle, Url}; use tokio::{fs, sync::mpsc}; use crate::{emit, external, files::FilesOp, tasks::TaskOp}; diff --git a/core/src/tasks/workers/process.rs b/yazi-core/src/tasks/workers/process.rs similarity index 100% rename from core/src/tasks/workers/process.rs rename to yazi-core/src/tasks/workers/process.rs diff --git a/core/src/which/mod.rs b/yazi-core/src/which/mod.rs similarity index 100% rename from core/src/which/mod.rs rename to yazi-core/src/which/mod.rs diff --git a/core/src/which/which.rs b/yazi-core/src/which/which.rs similarity index 95% rename from core/src/which/which.rs rename to yazi-core/src/which/which.rs index 36ec00528..cca92830b 100644 --- a/core/src/which/which.rs +++ b/yazi-core/src/which/which.rs @@ -1,6 +1,6 @@ use std::mem; -use config::{keymap::{Control, Key, KeymapLayer}, KEYMAP}; +use yazi_config::{keymap::{Control, Key, KeymapLayer}, KEYMAP}; use crate::emit; diff --git a/yazi-fm/Cargo.toml b/yazi-fm/Cargo.toml new file mode 100644 index 000000000..567581a4e --- /dev/null +++ b/yazi-fm/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "yazi-fm" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi File Manager" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" + +[dependencies] +yazi-adaptor = { path = "../yazi-adaptor", version = "0.1.5" } +yazi-config = { path = "../yazi-config", version = "0.1.5" } +yazi-core = { path = "../yazi-core", version = "0.1.5" } +yazi-plugin = { path = "../yazi-plugin", version = "0.1.5" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } + +# External dependencies +ansi-to-tui = "^3" +anyhow = "^1" +crossterm = { version = "^0", features = [ "event-stream" ] } +futures = "^0" +ratatui = "^0" +tokio = { version = "^1", features = [ "parking_lot" ] } +unicode-width = "^0" + +# Logging +tracing = "^0" +tracing-appender = "^0" +tracing-subscriber = "^0" + +[target."cfg(unix)".dependencies] +libc = "^0" +signal-hook-tokio = { version = "^0", features = [ "futures-v0_3" ] } + +[[bin]] +name = "yazi" +path = "src/main.rs" diff --git a/app/src/app.rs b/yazi-fm/src/app.rs similarity index 96% rename from app/src/app.rs rename to yazi-fm/src/app.rs index 059f5ca2c..ddf43c8b9 100644 --- a/app/src/app.rs +++ b/yazi-fm/src/app.rs @@ -1,11 +1,11 @@ -use core::{emit, files::FilesOp, input::InputMode, Ctx, Event}; use std::ffi::OsString; use anyhow::{Ok, Result}; -use config::{keymap::{Exec, Key, KeymapLayer}, BOOT}; use crossterm::event::KeyEvent; -use shared::{expand_url, Term}; use tokio::sync::oneshot; +use yazi_config::{keymap::{Exec, Key, KeymapLayer}, BOOT}; +use yazi_core::{emit, files::FilesOp, input::InputMode, Ctx, Event}; +use yazi_shared::{expand_url, Term}; use crate::{Executor, Logs, Root, Signals}; @@ -76,7 +76,7 @@ impl App { fn dispatch_render(&mut self) { if let Some(term) = &mut self.term { _ = term.draw(|f| { - plugin::scope(&self.cx, |_| { + yazi_plugin::scope(&self.cx, |_| { f.render_widget(Root::new(&self.cx), f.size()); }); diff --git a/app/src/executor.rs b/yazi-fm/src/executor.rs similarity index 97% rename from app/src/executor.rs rename to yazi-fm/src/executor.rs index 6a156a770..d3364f101 100644 --- a/app/src/executor.rs +++ b/yazi-fm/src/executor.rs @@ -1,7 +1,7 @@ -use core::{emit, input::InputMode, tab::FinderCase, Ctx}; +use yazi_core::{emit, input::InputMode, tab::FinderCase, Ctx}; -use config::{keymap::{Control, Exec, Key, KeymapLayer}, KEYMAP}; -use shared::{optional_bool, Url}; +use yazi_config::{keymap::{Control, Exec, Key, KeymapLayer}, KEYMAP}; +use yazi_shared::{optional_bool, Url}; pub(super) struct Executor; diff --git a/app/src/help/bindings.rs b/yazi-fm/src/help/bindings.rs similarity index 96% rename from app/src/help/bindings.rs rename to yazi-fm/src/help/bindings.rs index da714816b..d3514cd6f 100644 --- a/app/src/help/bindings.rs +++ b/yazi-fm/src/help/bindings.rs @@ -1,6 +1,6 @@ -use core::Ctx; +use yazi_core::Ctx; -use config::THEME; +use yazi_config::THEME; use ratatui::{layout::{self, Constraint}, prelude::{Buffer, Direction, Rect}, widgets::{List, ListItem, Widget}}; pub(super) struct Bindings<'a> { diff --git a/app/src/help/layout.rs b/yazi-fm/src/help/layout.rs similarity index 94% rename from app/src/help/layout.rs rename to yazi-fm/src/help/layout.rs index 84df3aee8..81362b761 100644 --- a/app/src/help/layout.rs +++ b/yazi-fm/src/help/layout.rs @@ -1,6 +1,6 @@ -use core::Ctx; +use yazi_core::Ctx; -use config::THEME; +use yazi_config::THEME; use ratatui::{buffer::Buffer, layout::{self, Rect}, prelude::{Constraint, Direction}, widgets::{Clear, Paragraph, Widget}}; use super::Bindings; diff --git a/app/src/help/mod.rs b/yazi-fm/src/help/mod.rs similarity index 100% rename from app/src/help/mod.rs rename to yazi-fm/src/help/mod.rs diff --git a/app/src/input/input.rs b/yazi-fm/src/input/input.rs similarity index 94% rename from app/src/input/input.rs rename to yazi-fm/src/input/input.rs index ccdc9f4c2..6b65a3e67 100644 --- a/app/src/input/input.rs +++ b/yazi-fm/src/input/input.rs @@ -1,10 +1,10 @@ -use core::{input::InputMode, Ctx}; +use yazi_core::{input::InputMode, Ctx}; use std::ops::Range; use ansi_to_tui::IntoText; -use config::THEME; +use yazi_config::THEME; use ratatui::{buffer::Buffer, layout::Rect, text::{Line, Text}, widgets::{Block, BorderType, Borders, Clear, Paragraph, Widget}}; -use shared::Term; +use yazi_shared::Term; pub(crate) struct Input<'a> { cx: &'a Ctx, diff --git a/app/src/input/mod.rs b/yazi-fm/src/input/mod.rs similarity index 100% rename from app/src/input/mod.rs rename to yazi-fm/src/input/mod.rs diff --git a/app/src/logs.rs b/yazi-fm/src/logs.rs similarity index 96% rename from app/src/logs.rs rename to yazi-fm/src/logs.rs index 0c52703b4..5a76637c6 100644 --- a/app/src/logs.rs +++ b/yazi-fm/src/logs.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Result}; -use config::BOOT; +use yazi_config::BOOT; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{fmt, prelude::__tracing_subscriber_SubscriberExt, Registry}; diff --git a/app/src/main.rs b/yazi-fm/src/main.rs similarity index 79% rename from app/src/main.rs rename to yazi-fm/src/main.rs index 1b712467a..f54e69c91 100644 --- a/app/src/main.rs +++ b/yazi-fm/src/main.rs @@ -21,13 +21,13 @@ use signals::*; async fn main() -> anyhow::Result<()> { // console_subscriber::init(); - config::init(); + yazi_config::init(); - core::init(); + yazi_core::init(); - plugin::init(); + yazi_plugin::init(); - adaptor::init(); + yazi_adaptor::init(); App::run().await } diff --git a/app/src/root.rs b/yazi-fm/src/root.rs similarity index 95% rename from app/src/root.rs rename to yazi-fm/src/root.rs index 7d0bf79ab..bacae7212 100644 --- a/app/src/root.rs +++ b/yazi-fm/src/root.rs @@ -1,7 +1,6 @@ -use core::Ctx; - -use plugin::components; use ratatui::{buffer::Buffer, layout::{Constraint, Direction, Layout, Rect}, widgets::Widget}; +use yazi_core::Ctx; +use yazi_plugin::components; use super::{input, select, tasks, which}; use crate::help; diff --git a/app/src/select/mod.rs b/yazi-fm/src/select/mod.rs similarity index 100% rename from app/src/select/mod.rs rename to yazi-fm/src/select/mod.rs diff --git a/app/src/select/select.rs b/yazi-fm/src/select/select.rs similarity index 95% rename from app/src/select/select.rs rename to yazi-fm/src/select/select.rs index f0b9a0dca..46017cad3 100644 --- a/app/src/select/select.rs +++ b/yazi-fm/src/select/select.rs @@ -1,6 +1,6 @@ -use core::Ctx; +use yazi_core::Ctx; -use config::THEME; +use yazi_config::THEME; use ratatui::{buffer::Buffer, layout::Rect, widgets::{Block, BorderType, Borders, Clear, List, ListItem, Widget}}; pub(crate) struct Select<'a> { diff --git a/app/src/signals.rs b/yazi-fm/src/signals.rs similarity index 99% rename from app/src/signals.rs rename to yazi-fm/src/signals.rs index 29a84d73a..f7f256393 100644 --- a/app/src/signals.rs +++ b/yazi-fm/src/signals.rs @@ -1,4 +1,4 @@ -use core::Event; +use yazi_core::Event; use anyhow::Result; use crossterm::event::{Event as CrosstermEvent, EventStream, KeyEvent, KeyEventKind}; diff --git a/app/src/tasks/clear.rs b/yazi-fm/src/tasks/clear.rs similarity index 100% rename from app/src/tasks/clear.rs rename to yazi-fm/src/tasks/clear.rs diff --git a/app/src/tasks/layout.rs b/yazi-fm/src/tasks/layout.rs similarity index 96% rename from app/src/tasks/layout.rs rename to yazi-fm/src/tasks/layout.rs index 82bfd53d6..0c071df22 100644 --- a/app/src/tasks/layout.rs +++ b/yazi-fm/src/tasks/layout.rs @@ -1,6 +1,6 @@ -use core::{tasks::TASKS_PERCENT, Ctx}; +use yazi_core::{tasks::TASKS_PERCENT, Ctx}; -use config::THEME; +use yazi_config::THEME; use ratatui::{buffer::Buffer, layout::{self, Alignment, Constraint, Direction, Rect}, text::Line, widgets::{Block, BorderType, Borders, List, ListItem, Padding, Widget}}; use super::Clear; diff --git a/app/src/tasks/mod.rs b/yazi-fm/src/tasks/mod.rs similarity index 100% rename from app/src/tasks/mod.rs rename to yazi-fm/src/tasks/mod.rs diff --git a/app/src/which/layout.rs b/yazi-fm/src/which/layout.rs similarity index 96% rename from app/src/which/layout.rs rename to yazi-fm/src/which/layout.rs index 89a7f9c8d..f86746caf 100644 --- a/app/src/which/layout.rs +++ b/yazi-fm/src/which/layout.rs @@ -1,6 +1,6 @@ -use core::Ctx; +use yazi_core::Ctx; -use config::THEME; +use yazi_config::THEME; use ratatui::{layout, prelude::{Buffer, Constraint, Direction, Rect}, widgets::{Block, Clear, Widget}}; use super::Side; diff --git a/app/src/which/mod.rs b/yazi-fm/src/which/mod.rs similarity index 100% rename from app/src/which/mod.rs rename to yazi-fm/src/which/mod.rs diff --git a/app/src/which/side.rs b/yazi-fm/src/which/side.rs similarity index 96% rename from app/src/which/side.rs rename to yazi-fm/src/which/side.rs index 2934cba85..b86097e1d 100644 --- a/app/src/which/side.rs +++ b/yazi-fm/src/which/side.rs @@ -1,4 +1,4 @@ -use config::{keymap::Control, THEME}; +use yazi_config::{keymap::Control, THEME}; use ratatui::{prelude::{Buffer, Rect}, text::{Line, Span}, widgets::{Block, List, ListItem, Padding, Widget}}; pub(super) struct Side<'a> { diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml new file mode 100644 index 000000000..32acf1690 --- /dev/null +++ b/yazi-plugin/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "yazi-plugin" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi plugin system" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" + +[dependencies] +yazi-config = { path = "../yazi-config", version = "0.1.5" } +yazi-core = { path = "../yazi-core", version = "0.1.5" } +yazi-shared = { path = "../yazi-shared", version = "0.1.5" } + +# External dependencies +ansi-to-tui = "^3" +anyhow = "^1" +mlua = { version = "^0", features = [ "luajit52", "vendored", "serialize" ] } +ratatui = "^0" +tracing = "^0" +unicode-width = "^0" diff --git a/plugin/preset/components/folder.lua b/yazi-plugin/preset/components/folder.lua similarity index 100% rename from plugin/preset/components/folder.lua rename to yazi-plugin/preset/components/folder.lua diff --git a/plugin/preset/components/header.lua b/yazi-plugin/preset/components/header.lua similarity index 100% rename from plugin/preset/components/header.lua rename to yazi-plugin/preset/components/header.lua diff --git a/plugin/preset/components/manager.lua b/yazi-plugin/preset/components/manager.lua similarity index 100% rename from plugin/preset/components/manager.lua rename to yazi-plugin/preset/components/manager.lua diff --git a/plugin/preset/components/status.lua b/yazi-plugin/preset/components/status.lua similarity index 100% rename from plugin/preset/components/status.lua rename to yazi-plugin/preset/components/status.lua diff --git a/plugin/preset/inspect/LICENSE b/yazi-plugin/preset/inspect/LICENSE similarity index 100% rename from plugin/preset/inspect/LICENSE rename to yazi-plugin/preset/inspect/LICENSE diff --git a/plugin/preset/inspect/inspect.lua b/yazi-plugin/preset/inspect/inspect.lua similarity index 100% rename from plugin/preset/inspect/inspect.lua rename to yazi-plugin/preset/inspect/inspect.lua diff --git a/plugin/preset/ui.lua b/yazi-plugin/preset/ui.lua similarity index 100% rename from plugin/preset/ui.lua rename to yazi-plugin/preset/ui.lua diff --git a/plugin/preset/utils.lua b/yazi-plugin/preset/utils.lua similarity index 100% rename from plugin/preset/utils.lua rename to yazi-plugin/preset/utils.lua diff --git a/plugin/src/bindings/active.rs b/yazi-plugin/src/bindings/active.rs similarity index 85% rename from plugin/src/bindings/active.rs rename to yazi-plugin/src/bindings/active.rs index 951743fcc..0a81bdfb8 100644 --- a/plugin/src/bindings/active.rs +++ b/yazi-plugin/src/bindings/active.rs @@ -1,7 +1,6 @@ -use core::Ctx; - -use config::MANAGER; use mlua::{AnyUserData, MetaMethod, UserDataFields, UserDataMethods, Value}; +use yazi_config::MANAGER; +use yazi_core::Ctx; use super::Url; use crate::LUA; @@ -9,13 +8,13 @@ use crate::LUA; pub struct Active<'a, 'b> { scope: &'b mlua::Scope<'a, 'a>, - cx: &'a core::Ctx, - inner: &'a core::tab::Tab, + cx: &'a yazi_core::Ctx, + inner: &'a yazi_core::tab::Tab, } impl<'a, 'b> Active<'a, 'b> { pub(crate) fn init() -> mlua::Result<()> { - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_method_get("is_select", |_, me| Ok(me.is_select())); reg.add_field_method_get("is_unset", |_, me| Ok(me.is_unset())); reg.add_field_method_get("is_visual", |_, me| Ok(me.is_visual())); @@ -24,7 +23,7 @@ impl<'a, 'b> Active<'a, 'b> { reg.add_meta_method(MetaMethod::ToString, |_, me, ()| Ok(me.to_string())); })?; - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_method_get("sort_by", |_, me| Ok(me.sort_by.to_string())); reg.add_field_method_get("sort_sensitive", |_, me| Ok(me.sort_sensitive)); reg.add_field_method_get("sort_reverse", |_, me| Ok(me.sort_reverse)); @@ -34,7 +33,7 @@ impl<'a, 'b> Active<'a, 'b> { reg.add_field_method_get("show_hidden", |_, me| Ok(me.show_hidden)); })?; - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_method_get("cwd", |_, me| Ok(Url::from(&me.cwd))); reg.add_field_method_get("offset", |_, me| Ok(me.offset)); reg.add_field_method_get("cursor", |_, me| Ok(me.cursor)); @@ -44,7 +43,7 @@ impl<'a, 'b> Active<'a, 'b> { reg.add_field_function_get("hovered", |_, me| me.named_user_value::("hovered")); })?; - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_function_get("folder", |_, me| me.named_user_value::("folder")); })?; @@ -71,7 +70,7 @@ impl<'a, 'b> Active<'a, 'b> { pub(crate) fn folder( &self, - inner: &'a core::tab::Folder, + inner: &'a yazi_core::tab::Folder, window: Option<(usize, usize)>, ) -> mlua::Result> { let window = window.unwrap_or_else(|| (inner.offset, MANAGER.layout.folder_height())); @@ -98,15 +97,15 @@ impl<'a, 'b> Active<'a, 'b> { Ok(ud) } - fn files(&self, inner: &'a core::files::Files) -> mlua::Result> { + fn files(&self, inner: &'a yazi_core::files::Files) -> mlua::Result> { self.scope.create_any_userdata_ref(inner) } fn file( &self, idx: usize, - inner: &'a core::files::File, - folder: &'a core::tab::Folder, + inner: &'a yazi_core::files::File, + folder: &'a yazi_core::tab::Folder, ) -> mlua::Result> { let ud = self.scope.create_any_userdata_ref(inner)?; ud.set_named_user_value("idx", idx)?; @@ -116,7 +115,7 @@ impl<'a, 'b> Active<'a, 'b> { Ok(ud) } - fn preview(&self, tab: &'a core::tab::Tab) -> mlua::Result> { + fn preview(&self, tab: &'a yazi_core::tab::Tab) -> mlua::Result> { let inner = &tab.preview; let ud = self.scope.create_any_userdata_ref(inner)?; diff --git a/plugin/src/bindings/bindings.rs b/yazi-plugin/src/bindings/bindings.rs similarity index 100% rename from plugin/src/bindings/bindings.rs rename to yazi-plugin/src/bindings/bindings.rs diff --git a/plugin/src/bindings/files.rs b/yazi-plugin/src/bindings/files.rs similarity index 72% rename from plugin/src/bindings/files.rs rename to yazi-plugin/src/bindings/files.rs index b6fb07309..4d75df9f5 100644 --- a/plugin/src/bindings/files.rs +++ b/yazi-plugin/src/bindings/files.rs @@ -1,15 +1,15 @@ use std::time::UNIX_EPOCH; -use config::THEME; use mlua::{AnyUserData, IntoLua, MetaMethod, UserData, UserDataFields, UserDataMethods, UserDataRef}; +use yazi_config::THEME; use super::{Range, Url}; use crate::{layout::Style, LUA}; -pub struct File(core::files::File); +pub struct File(yazi_core::files::File); -impl From<&core::files::File> for File { - fn from(value: &core::files::File) -> Self { Self(value.clone()) } +impl From<&yazi_core::files::File> for File { + fn from(value: &yazi_core::files::File) -> Self { Self(value.clone()) } } impl UserData for File { @@ -25,12 +25,12 @@ pub struct Files; impl Files { pub(crate) fn init() -> mlua::Result<()> { - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_meta_method(MetaMethod::Len, |_, me, ()| Ok(me.len())); reg.add_meta_function(MetaMethod::Pairs, |lua, me: AnyUserData| { let iter = lua.create_function(|lua, (me, i): (AnyUserData, usize)| { - let files = me.borrow::()?; + let files = me.borrow::()?; let i = i + 1; Ok(if i > files.len() { mlua::Variadic::new() @@ -42,12 +42,12 @@ impl Files { }); reg.add_function("slice", |_, (me, skip, take): (AnyUserData, usize, usize)| { - let files = me.borrow::()?; + let files = me.borrow::()?; Ok(files.iter().skip(skip).take(take).map(File::from).collect::>()) }); })?; - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_method_get("url", |_, me| Ok(Url::from(&me.url))); reg.add_field_method_get("link_to", |_, me| Ok(me.link_to().map(Url::from))); reg.add_field_method_get("is_link", |_, me| Ok(me.is_link)); @@ -78,33 +78,34 @@ impl Files { reg.add_field_method_get("accessed", |_, me| { Ok(me.meta.accessed()?.duration_since(UNIX_EPOCH).map(|d| d.as_secs_f64()).ok()) }); - reg.add_method("permissions", |_, me, ()| Ok(shared::permissions(me.meta.permissions()))); + reg + .add_method("permissions", |_, me, ()| Ok(yazi_shared::permissions(me.meta.permissions()))); // Extension reg.add_field_method_get("name", |_, me| { Ok(me.url.file_name().map(|n| n.to_string_lossy().to_string())) }); reg.add_function("size", |_, me: AnyUserData| { - let file = me.borrow::()?; + let file = me.borrow::()?; if !file.is_dir() { return Ok(Some(file.meta.len())); } - let folder = me.named_user_value::>("folder")?; + let folder = me.named_user_value::>("folder")?; Ok(folder.files.sizes.get(&file.url).copied()) }); reg.add_function("mime", |_, me: AnyUserData| { - let manager = me.named_user_value::>("manager")?; - let file = me.borrow::()?; + let manager = me.named_user_value::>("manager")?; + let file = me.borrow::()?; Ok(manager.mimetype.get(&file.url).cloned()) }); reg.add_function("prefix", |_, me: AnyUserData| { - let folder = me.named_user_value::>("folder")?; + let folder = me.named_user_value::>("folder")?; if !folder.cwd.is_search() { return Ok(None); } - let file = me.borrow::()?; + let file = me.borrow::()?; let mut p = file.url.strip_prefix(&folder.cwd).unwrap_or(&file.url).components(); p.next_back(); Ok(Some(p.as_path().to_string_lossy().to_string())) @@ -119,8 +120,8 @@ impl Files { ) }); reg.add_function("style", |_, me: AnyUserData| { - let manager = me.named_user_value::>("manager")?; - let file = me.borrow::()?; + let manager = me.named_user_value::>("manager")?; + let file = me.borrow::()?; let mime = manager.mimetype.get(&file.url); Ok( THEME @@ -131,13 +132,13 @@ impl Files { ) }); reg.add_function("is_hovered", |_, me: AnyUserData| { - let folder = me.named_user_value::>("folder")?; - let file = me.borrow::()?; + let folder = me.named_user_value::>("folder")?; + let file = me.borrow::()?; Ok(matches!(folder.hovered(), Some(f) if f.url == file.url)) }); reg.add_function("is_yanked", |_, me: AnyUserData| { - let manager = me.named_user_value::>("manager")?; - let file = me.borrow::()?; + let manager = me.named_user_value::>("manager")?; + let file = me.borrow::()?; Ok(if !manager.yanked.1.contains(&file.url) { 0u8 } else if manager.yanked.0 { @@ -147,9 +148,9 @@ impl Files { }) }); reg.add_function("is_selected", |_, me: AnyUserData| { - let manager = me.named_user_value::>("manager")?; - let folder = me.named_user_value::>("folder")?; - let file = me.borrow::()?; + let manager = me.named_user_value::>("manager")?; + let folder = me.named_user_value::>("folder")?; + let file = me.borrow::()?; let selected = folder.files.is_selected(&file.url); Ok(if !manager.active().mode.is_visual() { @@ -160,12 +161,12 @@ impl Files { }) }); reg.add_function("found", |lua, me: AnyUserData| { - let manager = me.named_user_value::>("manager")?; + let manager = me.named_user_value::>("manager")?; let Some(finder) = &manager.active().finder else { return Ok(None); }; - let file = me.borrow::()?; + let file = me.borrow::()?; if let Some(idx) = finder.matched_idx(&file.url) { return Some( lua.create_sequence_from([idx.into_lua(lua)?, finder.matched().len().into_lua(lua)?]), @@ -175,12 +176,12 @@ impl Files { Ok(None) }); reg.add_function("highlights", |_, me: AnyUserData| { - let manager = me.named_user_value::>("manager")?; + let manager = me.named_user_value::>("manager")?; let Some(finder) = &manager.active().finder else { return Ok(None); }; - let file = me.borrow::()?; + let file = me.borrow::()?; let Some(h) = file.name().and_then(|n| finder.highlighted(n)) else { return Ok(None); }; diff --git a/plugin/src/bindings/mod.rs b/yazi-plugin/src/bindings/mod.rs similarity index 100% rename from plugin/src/bindings/mod.rs rename to yazi-plugin/src/bindings/mod.rs diff --git a/plugin/src/bindings/shared.rs b/yazi-plugin/src/bindings/shared.rs similarity index 89% rename from plugin/src/bindings/shared.rs rename to yazi-plugin/src/bindings/shared.rs index 3806486bc..96e391202 100644 --- a/plugin/src/bindings/shared.rs +++ b/yazi-plugin/src/bindings/shared.rs @@ -18,10 +18,10 @@ where } // --- Url -pub struct Url(shared::Url); +pub struct Url(yazi_shared::Url); -impl From<&shared::Url> for Url { - fn from(value: &shared::Url) -> Self { Self(value.clone()) } +impl From<&yazi_shared::Url> for Url { + fn from(value: &yazi_shared::Url) -> Self { Self(value.clone()) } } impl UserData for Url { diff --git a/plugin/src/bindings/tabs.rs b/yazi-plugin/src/bindings/tabs.rs similarity index 79% rename from plugin/src/bindings/tabs.rs rename to yazi-plugin/src/bindings/tabs.rs index 657bade50..8d31e8b53 100644 --- a/plugin/src/bindings/tabs.rs +++ b/yazi-plugin/src/bindings/tabs.rs @@ -5,12 +5,12 @@ use crate::LUA; pub struct Tabs<'a, 'b> { scope: &'b mlua::Scope<'a, 'a>, - inner: &'a core::manager::Tabs, + inner: &'a yazi_core::manager::Tabs, } impl<'a, 'b> Tabs<'a, 'b> { pub(crate) fn init() -> mlua::Result<()> { - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_method_get("idx", |_, me| Ok(me.idx)); reg.add_meta_method(MetaMethod::Len, |_, me, ()| Ok(me.len())); reg.add_meta_function(MetaMethod::Index, |_, (me, index): (AnyUserData, usize)| { @@ -19,7 +19,7 @@ impl<'a, 'b> Tabs<'a, 'b> { }); })?; - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_method("name", |_, me, ()| { Ok( me.current @@ -42,7 +42,7 @@ impl<'a, 'b> Tabs<'a, 'b> { Ok(()) } - pub(crate) fn new(scope: &'b mlua::Scope<'a, 'a>, inner: &'a core::manager::Tabs) -> Self { + pub(crate) fn new(scope: &'b mlua::Scope<'a, 'a>, inner: &'a yazi_core::manager::Tabs) -> Self { Self { scope, inner } } @@ -57,7 +57,7 @@ impl<'a, 'b> Tabs<'a, 'b> { Ok(ud) } - fn tab(&self, inner: &'a core::tab::Tab) -> mlua::Result> { + fn tab(&self, inner: &'a yazi_core::tab::Tab) -> mlua::Result> { let ud = self.scope.create_any_userdata_ref(inner)?; ud.set_named_user_value("parent", inner.parent.as_ref().and_then(|p| self.folder(p).ok()))?; @@ -67,18 +67,18 @@ impl<'a, 'b> Tabs<'a, 'b> { Ok(ud) } - pub(crate) fn folder(&self, inner: &'a core::tab::Folder) -> mlua::Result> { + pub(crate) fn folder(&self, inner: &'a yazi_core::tab::Folder) -> mlua::Result> { let ud = self.scope.create_any_userdata_ref(inner)?; ud.set_named_user_value("files", self.files(&inner.files)?)?; Ok(ud) } - fn files(&self, inner: &'a core::files::Files) -> mlua::Result> { + fn files(&self, inner: &'a yazi_core::files::Files) -> mlua::Result> { self.scope.create_any_userdata_ref(inner) } - fn preview(&self, tab: &'a core::tab::Tab) -> mlua::Result> { + fn preview(&self, tab: &'a yazi_core::tab::Tab) -> mlua::Result> { let inner = &tab.preview; let ud = self.scope.create_any_userdata_ref(inner)?; diff --git a/plugin/src/bindings/tasks.rs b/yazi-plugin/src/bindings/tasks.rs similarity index 69% rename from plugin/src/bindings/tasks.rs rename to yazi-plugin/src/bindings/tasks.rs index 3e60aa773..079471821 100644 --- a/plugin/src/bindings/tasks.rs +++ b/yazi-plugin/src/bindings/tasks.rs @@ -5,19 +5,19 @@ use crate::LUA; pub struct Tasks<'a, 'b> { scope: &'b mlua::Scope<'a, 'a>, - inner: &'a core::tasks::Tasks, + inner: &'a yazi_core::tasks::Tasks, } impl<'a, 'b> Tasks<'a, 'b> { pub(crate) fn init() -> mlua::Result<()> { - LUA.register_userdata_type::(|reg| { + LUA.register_userdata_type::(|reg| { reg.add_field_method_get("progress", |lua, me| lua.to_value(&me.progress)) })?; Ok(()) } - pub(crate) fn new(scope: &'b mlua::Scope<'a, 'a>, inner: &'a core::tasks::Tasks) -> Self { + pub(crate) fn new(scope: &'b mlua::Scope<'a, 'a>, inner: &'a yazi_core::tasks::Tasks) -> Self { Self { scope, inner } } diff --git a/plugin/src/components/base.rs b/yazi-plugin/src/components/base.rs similarity index 92% rename from plugin/src/components/base.rs rename to yazi-plugin/src/components/base.rs index 3245b2c2c..789dfc39e 100644 --- a/plugin/src/components/base.rs +++ b/yazi-plugin/src/components/base.rs @@ -20,7 +20,7 @@ impl Base { ) } - pub fn render(self, cx: &core::Ctx, buf: &mut ratatui::buffer::Buffer) { + pub fn render(self, cx: &yazi_core::Ctx, buf: &mut ratatui::buffer::Buffer) { if self.kind == 0 { super::Preview::new(cx).render(self.area, buf) } diff --git a/plugin/src/components/components.rs b/yazi-plugin/src/components/components.rs similarity index 96% rename from plugin/src/components/components.rs rename to yazi-plugin/src/components/components.rs index f23386c37..72d58ffd1 100644 --- a/plugin/src/components/components.rs +++ b/yazi-plugin/src/components/components.rs @@ -1,5 +1,5 @@ use mlua::{AnyUserData, Table}; -use shared::RoCell; +use yazi_shared::RoCell; use super::Base; use crate::{layout::{Bar, Border, Gauge, List, Paragraph}, GLOBALS}; @@ -19,7 +19,7 @@ pub fn init() -> mlua::Result<()> { pub(super) fn layout( values: Vec, - cx: &core::Ctx, + cx: &yazi_core::Ctx, buf: &mut ratatui::prelude::Buffer, ) -> mlua::Result<()> { for value in values { diff --git a/plugin/src/components/folder.rs b/yazi-plugin/src/components/folder.rs similarity index 70% rename from plugin/src/components/folder.rs rename to yazi-plugin/src/components/folder.rs index 5b4a3830e..9c48eb7a1 100644 --- a/plugin/src/components/folder.rs +++ b/yazi-plugin/src/components/folder.rs @@ -6,19 +6,19 @@ use super::{layout, COMP_FOLDER}; use crate::{layout::Rect, LUA}; pub struct Folder<'a> { - cx: &'a core::Ctx, + cx: &'a yazi_core::Ctx, kind: u8, } impl<'a> Folder<'a> { #[inline] - pub fn parent(cx: &'a core::Ctx) -> Self { Self { cx, kind: 0 } } + pub fn parent(cx: &'a yazi_core::Ctx) -> Self { Self { cx, kind: 0 } } #[inline] - pub fn current(cx: &'a core::Ctx) -> Self { Self { cx, kind: 1 } } + pub fn current(cx: &'a yazi_core::Ctx) -> Self { Self { cx, kind: 1 } } #[inline] - pub fn preview(cx: &'a core::Ctx) -> Self { Self { cx, kind: 2 } } + pub fn preview(cx: &'a yazi_core::Ctx) -> Self { Self { cx, kind: 2 } } } impl<'a> Widget for Folder<'a> { diff --git a/plugin/src/components/header.rs b/yazi-plugin/src/components/header.rs similarity index 84% rename from plugin/src/components/header.rs rename to yazi-plugin/src/components/header.rs index 8c1fccc79..4a232c939 100644 --- a/plugin/src/components/header.rs +++ b/yazi-plugin/src/components/header.rs @@ -6,12 +6,12 @@ use super::{layout, COMP_HEADER}; use crate::layout::Rect; pub struct Header<'a> { - cx: &'a core::Ctx, + cx: &'a yazi_core::Ctx, } impl<'a> Header<'a> { #[inline] - pub fn new(cx: &'a core::Ctx) -> Self { Self { cx } } + pub fn new(cx: &'a yazi_core::Ctx) -> Self { Self { cx } } } impl<'a> Widget for Header<'a> { diff --git a/plugin/src/components/manager.rs b/yazi-plugin/src/components/manager.rs similarity index 84% rename from plugin/src/components/manager.rs rename to yazi-plugin/src/components/manager.rs index dd333d6a0..2ff4c990c 100644 --- a/plugin/src/components/manager.rs +++ b/yazi-plugin/src/components/manager.rs @@ -6,11 +6,11 @@ use super::{layout, COMP_MANAGER}; use crate::layout::Rect; pub struct Manager<'a> { - cx: &'a core::Ctx, + cx: &'a yazi_core::Ctx, } impl<'a> Manager<'a> { - pub fn new(cx: &'a core::Ctx) -> Self { Self { cx } } + pub fn new(cx: &'a yazi_core::Ctx) -> Self { Self { cx } } } impl<'a> Widget for Manager<'a> { diff --git a/plugin/src/components/mod.rs b/yazi-plugin/src/components/mod.rs similarity index 100% rename from plugin/src/components/mod.rs rename to yazi-plugin/src/components/mod.rs diff --git a/plugin/src/components/preview.rs b/yazi-plugin/src/components/preview.rs similarity index 94% rename from plugin/src/components/preview.rs rename to yazi-plugin/src/components/preview.rs index 8176675f5..20af33edc 100644 --- a/plugin/src/components/preview.rs +++ b/yazi-plugin/src/components/preview.rs @@ -1,4 +1,4 @@ -use core::{preview::PreviewData, Ctx}; +use yazi_core::{preview::PreviewData, Ctx}; use ansi_to_tui::IntoText; use ratatui::{buffer::Buffer, layout::Rect, widgets::{Paragraph, Widget}}; diff --git a/plugin/src/components/status.rs b/yazi-plugin/src/components/status.rs similarity index 84% rename from plugin/src/components/status.rs rename to yazi-plugin/src/components/status.rs index fdb6a41e7..6cc637e58 100644 --- a/plugin/src/components/status.rs +++ b/yazi-plugin/src/components/status.rs @@ -6,12 +6,12 @@ use super::{layout, COMP_STATUS}; use crate::layout::Rect; pub struct Status<'a> { - cx: &'a core::Ctx, + cx: &'a yazi_core::Ctx, } impl<'a> Status<'a> { #[inline] - pub fn new(cx: &'a core::Ctx) -> Self { Self { cx } } + pub fn new(cx: &'a yazi_core::Ctx) -> Self { Self { cx } } } impl<'a> Widget for Status<'a> { diff --git a/plugin/src/config.rs b/yazi-plugin/src/config.rs similarity index 53% rename from plugin/src/config.rs rename to yazi-plugin/src/config.rs index 5802d4b35..2ab522446 100644 --- a/plugin/src/config.rs +++ b/yazi-plugin/src/config.rs @@ -1,4 +1,5 @@ use mlua::{LuaSerdeExt, SerializeOptions, Table}; +use yazi_config::{MANAGER, THEME}; use crate::{layout::Rect, GLOBALS, LUA}; @@ -16,30 +17,24 @@ impl Config { } fn theme(self, options: SerializeOptions) -> mlua::Result<()> { - GLOBALS.set("THEME", LUA.to_value_with(&*config::THEME, options)?) + GLOBALS.set("THEME", LUA.to_value_with(&*THEME, options)?) } fn manager(self, options: SerializeOptions) -> mlua::Result<()> { - let manager = LUA.to_value_with(&*config::MANAGER, options)?; + let manager = LUA.to_value_with(&*MANAGER, options)?; { let layout: Table = manager.as_table().unwrap().get("layout")?; layout.set( "preview_rect", - LUA.create_function(|_, ()| Ok(Rect(config::MANAGER.layout.preview_rect())))?, - )?; - layout.set( - "preview_height", - LUA.create_function(|_, ()| Ok(config::MANAGER.layout.preview_height()))?, - )?; - layout.set( - "folder_rect", - LUA.create_function(|_, ()| Ok(Rect(config::MANAGER.layout.folder_rect())))?, - )?; - layout.set( - "folder_height", - LUA.create_function(|_, ()| Ok(config::MANAGER.layout.folder_height()))?, + LUA.create_function(|_, ()| Ok(Rect(MANAGER.layout.preview_rect())))?, )?; + layout + .set("preview_height", LUA.create_function(|_, ()| Ok(MANAGER.layout.preview_height()))?)?; + layout + .set("folder_rect", LUA.create_function(|_, ()| Ok(Rect(MANAGER.layout.folder_rect())))?)?; + layout + .set("folder_height", LUA.create_function(|_, ()| Ok(MANAGER.layout.folder_height()))?)?; } GLOBALS.set("MANAGER", manager) diff --git a/plugin/src/layout/bar.rs b/yazi-plugin/src/layout/bar.rs similarity index 100% rename from plugin/src/layout/bar.rs rename to yazi-plugin/src/layout/bar.rs diff --git a/plugin/src/layout/border.rs b/yazi-plugin/src/layout/border.rs similarity index 100% rename from plugin/src/layout/border.rs rename to yazi-plugin/src/layout/border.rs diff --git a/plugin/src/layout/constraint.rs b/yazi-plugin/src/layout/constraint.rs similarity index 100% rename from plugin/src/layout/constraint.rs rename to yazi-plugin/src/layout/constraint.rs diff --git a/plugin/src/layout/gauge.rs b/yazi-plugin/src/layout/gauge.rs similarity index 100% rename from plugin/src/layout/gauge.rs rename to yazi-plugin/src/layout/gauge.rs diff --git a/plugin/src/layout/layout.rs b/yazi-plugin/src/layout/layout.rs similarity index 100% rename from plugin/src/layout/layout.rs rename to yazi-plugin/src/layout/layout.rs diff --git a/plugin/src/layout/line.rs b/yazi-plugin/src/layout/line.rs similarity index 100% rename from plugin/src/layout/line.rs rename to yazi-plugin/src/layout/line.rs diff --git a/plugin/src/layout/list.rs b/yazi-plugin/src/layout/list.rs similarity index 100% rename from plugin/src/layout/list.rs rename to yazi-plugin/src/layout/list.rs diff --git a/plugin/src/layout/mod.rs b/yazi-plugin/src/layout/mod.rs similarity index 100% rename from plugin/src/layout/mod.rs rename to yazi-plugin/src/layout/mod.rs diff --git a/plugin/src/layout/padding.rs b/yazi-plugin/src/layout/padding.rs similarity index 100% rename from plugin/src/layout/padding.rs rename to yazi-plugin/src/layout/padding.rs diff --git a/plugin/src/layout/paragraph.rs b/yazi-plugin/src/layout/paragraph.rs similarity index 100% rename from plugin/src/layout/paragraph.rs rename to yazi-plugin/src/layout/paragraph.rs diff --git a/plugin/src/layout/rect.rs b/yazi-plugin/src/layout/rect.rs similarity index 100% rename from plugin/src/layout/rect.rs rename to yazi-plugin/src/layout/rect.rs diff --git a/plugin/src/layout/span.rs b/yazi-plugin/src/layout/span.rs similarity index 98% rename from plugin/src/layout/span.rs rename to yazi-plugin/src/layout/span.rs index 366a1b72f..b96c6da30 100644 --- a/plugin/src/layout/span.rs +++ b/yazi-plugin/src/layout/span.rs @@ -1,4 +1,4 @@ -use config::theme::Color; +use yazi_config::theme::Color; use mlua::{AnyUserData, FromLua, Lua, Table, UserData, UserDataMethods, Value}; use super::Style; diff --git a/plugin/src/layout/style.rs b/yazi-plugin/src/layout/style.rs similarity index 95% rename from plugin/src/layout/style.rs rename to yazi-plugin/src/layout/style.rs index 976087e21..14b05f9df 100644 --- a/plugin/src/layout/style.rs +++ b/yazi-plugin/src/layout/style.rs @@ -1,5 +1,5 @@ -use config::theme::Color; use mlua::{AnyUserData, FromLua, Lua, Table, UserData, UserDataMethods, Value}; +use yazi_config::theme::Color; use crate::{GLOBALS, LUA}; @@ -13,8 +13,8 @@ impl Style { } } -impl From for Style { - fn from(value: config::theme::Style) -> Self { Self(value.into()) } +impl From for Style { + fn from(value: yazi_config::theme::Style) -> Self { Self(value.into()) } } impl<'a> From> for Style { diff --git a/plugin/src/lib.rs b/yazi-plugin/src/lib.rs similarity index 100% rename from plugin/src/lib.rs rename to yazi-plugin/src/lib.rs diff --git a/plugin/src/plugin.rs b/yazi-plugin/src/plugin.rs similarity index 97% rename from plugin/src/plugin.rs rename to yazi-plugin/src/plugin.rs index 8b4d8e462..6dca0aa5c 100644 --- a/plugin/src/plugin.rs +++ b/yazi-plugin/src/plugin.rs @@ -1,7 +1,7 @@ use anyhow::Result; -use config::PLUGINS; +use yazi_config::PLUGINS; use mlua::{Lua, Table}; -use shared::RoCell; +use yazi_shared::RoCell; use crate::{bindings, components, layout, utils}; diff --git a/plugin/src/scope.rs b/yazi-plugin/src/scope.rs similarity index 95% rename from plugin/src/scope.rs rename to yazi-plugin/src/scope.rs index 2357e794a..190dae274 100644 --- a/plugin/src/scope.rs +++ b/yazi-plugin/src/scope.rs @@ -1,4 +1,4 @@ -use core::Ctx; +use yazi_core::Ctx; pub use mlua::Scope; diff --git a/plugin/src/utils.rs b/yazi-plugin/src/utils.rs similarity index 100% rename from plugin/src/utils.rs rename to yazi-plugin/src/utils.rs diff --git a/shared/Cargo.toml b/yazi-shared/Cargo.toml similarity index 51% rename from shared/Cargo.toml rename to yazi-shared/Cargo.toml index b89388a18..596ff820b 100644 --- a/shared/Cargo.toml +++ b/yazi-shared/Cargo.toml @@ -1,7 +1,12 @@ [package] -name = "shared" -version = "0.1.5" -edition = "2021" +name = "yazi-shared" +version = "0.1.5" +edition = "2021" +license = "MIT" +authors = [ "sxyazi " ] +description = "Yazi shared library" +homepage = "https://yazi-rs.github.io" +repository = "https://github.com/sxyazi/yazi" [dependencies] anyhow = "^1" diff --git a/shared/src/chars.rs b/yazi-shared/src/chars.rs similarity index 100% rename from shared/src/chars.rs rename to yazi-shared/src/chars.rs diff --git a/shared/src/debounce.rs b/yazi-shared/src/debounce.rs similarity index 100% rename from shared/src/debounce.rs rename to yazi-shared/src/debounce.rs diff --git a/shared/src/defer.rs b/yazi-shared/src/defer.rs similarity index 100% rename from shared/src/defer.rs rename to yazi-shared/src/defer.rs diff --git a/shared/src/errors/input.rs b/yazi-shared/src/errors/input.rs similarity index 100% rename from shared/src/errors/input.rs rename to yazi-shared/src/errors/input.rs diff --git a/shared/src/errors/mod.rs b/yazi-shared/src/errors/mod.rs similarity index 100% rename from shared/src/errors/mod.rs rename to yazi-shared/src/errors/mod.rs diff --git a/shared/src/errors/peek.rs b/yazi-shared/src/errors/peek.rs similarity index 100% rename from shared/src/errors/peek.rs rename to yazi-shared/src/errors/peek.rs diff --git a/shared/src/fns.rs b/yazi-shared/src/fns.rs similarity index 100% rename from shared/src/fns.rs rename to yazi-shared/src/fns.rs diff --git a/shared/src/fs.rs b/yazi-shared/src/fs.rs similarity index 100% rename from shared/src/fs.rs rename to yazi-shared/src/fs.rs diff --git a/shared/src/lib.rs b/yazi-shared/src/lib.rs similarity index 100% rename from shared/src/lib.rs rename to yazi-shared/src/lib.rs diff --git a/shared/src/mime.rs b/yazi-shared/src/mime.rs similarity index 100% rename from shared/src/mime.rs rename to yazi-shared/src/mime.rs diff --git a/shared/src/natsort.rs b/yazi-shared/src/natsort.rs similarity index 100% rename from shared/src/natsort.rs rename to yazi-shared/src/natsort.rs diff --git a/shared/src/ro_cell.rs b/yazi-shared/src/ro_cell.rs similarity index 100% rename from shared/src/ro_cell.rs rename to yazi-shared/src/ro_cell.rs diff --git a/shared/src/term/cursor.rs b/yazi-shared/src/term/cursor.rs similarity index 100% rename from shared/src/term/cursor.rs rename to yazi-shared/src/term/cursor.rs diff --git a/shared/src/term/mod.rs b/yazi-shared/src/term/mod.rs similarity index 100% rename from shared/src/term/mod.rs rename to yazi-shared/src/term/mod.rs diff --git a/shared/src/term/term.rs b/yazi-shared/src/term/term.rs similarity index 100% rename from shared/src/term/term.rs rename to yazi-shared/src/term/term.rs diff --git a/shared/src/throttle.rs b/yazi-shared/src/throttle.rs similarity index 100% rename from shared/src/throttle.rs rename to yazi-shared/src/throttle.rs diff --git a/shared/src/time.rs b/yazi-shared/src/time.rs similarity index 100% rename from shared/src/time.rs rename to yazi-shared/src/time.rs diff --git a/shared/src/url.rs b/yazi-shared/src/url.rs similarity index 100% rename from shared/src/url.rs rename to yazi-shared/src/url.rs