Skip to main content

lowfat_plugin/
embedded.rs

1//! Plugins bundled into the binary at compile time.
2//!
3//! These are the canonical replacements for the deleted native Rust filters
4//! (git/docker/ls). They ship as **data** — DSL configuration, not Rust code —
5//! so the lowfat binary itself only contains coreutils-equivalent logic + the
6//! plugin protocol. A user can shadow any bundled plugin by dropping a file
7//! at `~/.lowfat/plugins/<category>/<name>/filter.lf` — disk wins over bundled
8//! in `discover_plugins`.
9//!
10//! Only the load-bearing files (`lowfat.toml` + `filter.lf`) are embedded.
11//! Samples, BENCHMARK.md, bench.sh, and the legacy filter.sh are deliberately
12//! left out of the binary — they're documentation, not runtime. The package
13//! `exclude` in Cargo.toml also keeps them out of the published crate tarball.
14//!
15//! The bundled plugins live in this crate's `embedded/` dir (not the
16//! workspace-root `plugins/`, which holds community plugins). They must stay
17//! inside the crate: `include_str!` paths can't reach files outside the package
18//! root, or `cargo publish` won't ship them.
19
20pub struct EmbeddedPlugin {
21    pub category: &'static str,
22    pub name: &'static str,
23    pub manifest: &'static str,
24    pub filter_lf: &'static str,
25}
26
27pub const EMBEDDED: &[EmbeddedPlugin] = &[
28    EmbeddedPlugin {
29        category: "git",
30        name: "git-compact",
31        manifest: include_str!("../embedded/git/git-compact/lowfat.toml"),
32        filter_lf: include_str!("../embedded/git/git-compact/filter.lf"),
33    },
34    EmbeddedPlugin {
35        category: "docker",
36        name: "docker-compact",
37        manifest: include_str!("../embedded/docker/docker-compact/lowfat.toml"),
38        filter_lf: include_str!("../embedded/docker/docker-compact/filter.lf"),
39    },
40    EmbeddedPlugin {
41        category: "ls",
42        name: "ls-compact",
43        manifest: include_str!("../embedded/ls/ls-compact/lowfat.toml"),
44        filter_lf: include_str!("../embedded/ls/ls-compact/filter.lf"),
45    },
46    EmbeddedPlugin {
47        category: "find",
48        name: "find-compact",
49        manifest: include_str!("../embedded/find/find-compact/lowfat.toml"),
50        filter_lf: include_str!("../embedded/find/find-compact/filter.lf"),
51    },
52    EmbeddedPlugin {
53        category: "grep",
54        name: "grep-compact",
55        manifest: include_str!("../embedded/grep/grep-compact/lowfat.toml"),
56        filter_lf: include_str!("../embedded/grep/grep-compact/filter.lf"),
57    },
58    EmbeddedPlugin {
59        category: "tree",
60        name: "tree-compact",
61        manifest: include_str!("../embedded/tree/tree-compact/lowfat.toml"),
62        filter_lf: include_str!("../embedded/tree/tree-compact/filter.lf"),
63    },
64];