LivacoNew / CrabFetch

Extremely fast, featureful and customizable command-line fetcher.
Apache License 2.0
21 stars 4 forks source link

Support Custom command module #30

Open FlyinPancake opened 2 months ago

FlyinPancake commented 2 months ago

What would you like to see added to CrabFetch? I'd love to have some custom modules

What use would this be? For niche use-cases like rpm-ostree deployments that the wider linux world does not care about, crabfetch could support external modules.

Additional Comments The module I'd like to convert from fastfetch

{
            "type": "command",
            "key": " 󱋩",
            "text": "/usr/libexec/bazzite-fetch-image"
},
LivacoNew commented 2 months ago

This already links into another plan I already have which is per-module configuration, e.g you could have two displays modules but one only outputs the res, while the other grabs the DRM name (bad example but i suck at examples so deal with it)

TOML allows mixed type arrays for this to be embedded directly into the modules array, but I'm not sure how the config crate I use would let me use it.

Either way, once that's implemented I can start looking into this.

FlyinPancake commented 2 months ago

So, if I read this correctly, you want to embed all module settings in the modules array instead of the placeholder strings?

LivacoNew commented 2 months ago

Not quite, moreso you can override the module's settings for a single entry. Example;

modules = [
    "displays",     # Uses the default displays
    {"displays", {
        title = "But this uses a different title, but is the same module"
    }}
]

This way your custom commands can simply be done like so;

modules = [
    {"custom", {
        title = "Custommm",
        exec = "/some/where/myscript.sh"
    }}
]