Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Lua? #22

Open
zoeleu opened this issue May 3, 2021 · 14 comments
Open

Why Lua? #22

zoeleu opened this issue May 3, 2021 · 14 comments

Comments

@zoeleu
Copy link

zoeleu commented May 3, 2021

Why is lua necessary? Isn't it possible to not use Lua?

@K4rakara
Copy link
Owner

K4rakara commented May 3, 2021

Lua is used to allow users to customize freshfetch, rather than make their own fetch just for a different look. The API isn't very user friendly as of writing this, but it literally lets you do anything you want, within the limits of ANSI escape codes.

@zoeleu
Copy link
Author

zoeleu commented May 4, 2021 via email

@zoeleu
Copy link
Author

zoeleu commented May 4, 2021

  • from what I understood, no dynamic features are currently being used. It is better to make a "compiler" for the ANSI escape code features that are required for customization.

@K4rakara
Copy link
Owner

K4rakara commented May 4, 2021

What Lua also allows is for users to fetch their own information.

I may make a cfg flag that removes lua when I rework the codebase, but it wouldn't be the default.

@zoeleu
Copy link
Author

zoeleu commented May 6, 2021 via email

@K4rakara
Copy link
Owner

K4rakara commented May 7, 2021

I don't believe in the suckless mentality of forcing users to recompile their programs to configure them.

I'm not against having a rust config, but if i did it it would be dynamically loaded or something.

@zoeleu
Copy link
Author

zoeleu commented May 17, 2021 via email

@Speykious
Copy link

@K4rakara I'm 2 months late in the matter, but what about making it configurable through a TOML file? It's kind of a standard for Rust programs and it works really well.
Take a look at Starship for example. It's an incredibly extensible prompt also written in Rust, and it's configured with TOML.

(Maybe I can even try to code that in, hmmm)

@zoeleu
Copy link
Author

zoeleu commented Jul 16, 2021 via email

@K4rakara
Copy link
Owner

@Speykious, @matteoturini

After reflecting further, I think you're right. I plan to rewrite the codebase in async Rust, with a config.rs file in the repo root. The default config.rs file will have a simple TOML config reader. That way, if you wanted to use it in a suckless manner, you could, or if you wanted to use it with a config file, you could.

Rewriting this is gonna take a while, I've got a lot of IRL things going on at the moment. I'll leave additional comments on this thread once I make some headway.

@zoeleu
Copy link
Author

zoeleu commented Aug 10, 2021 via email

@VarLad
Copy link

VarLad commented Oct 25, 2021

@K4rakara What about using Rhai for the config part?

@K4rakara
Copy link
Owner

@K4rakara What about using Rhai for the config part?

While Rhai is cool, I don't think I'm going to support configuring it with it out of the box.

I don't know how to explain it well, but Rust crates are heavier, at least when they are statically linked. I'd rather not statically link an entire programming language for configuring a system fetch.

@VarLad
Copy link

VarLad commented Oct 29, 2021

But how about as an alternative for writing plugins instead of Lua?
Rhai is really small as well, and is suitable for such purposes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants