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

Replace config struct with a config crate #605

Open
RedEtherbloom opened this issue Nov 13, 2024 · 4 comments
Open

Replace config struct with a config crate #605

RedEtherbloom opened this issue Nov 13, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@RedEtherbloom
Copy link
Collaborator

Description

Our current config struct is both error-prone and tedious to extend(many getters, non-standard ways of setting defaults).
While not a major concern, it also recomputes a lot, adding 10-50ms to startup(depending on hardware and .taskrc)

Solution

Replace our config struct with an implementation derived from one of the major config crates, like config or comfique.
This would also make the transition to our own config file easier, as we could add it and task _shows output both as sources to the config builder.

Additional context

If possible a config struct behind something like an Arc<Mutex<>> would be ideal, to futureproof both for config reloading and more robust async/multithreading.

@RedEtherbloom RedEtherbloom added the enhancement New feature or request label Nov 13, 2024
@RedEtherbloom
Copy link
Collaborator Author

#520

@kdheepak
Copy link
Owner

kdheepak commented Nov 13, 2024

I would like to move taskwarrior-tui configuration to a separate file, either a config.toml or a config.lua file.

I really like the idea of using a config.lua because we can extend the config to support callback functions and allow for more customization in the future. But it may be more work than it is worth.

@RedEtherbloom
Copy link
Collaborator Author

I think sticking to a config.toml for now and adding a config.lua file once we introduce more customability is what we would go for.
Good potential choices for customability may also be cargoscript, although we haven't looked into it yet.

@RedEtherbloom
Copy link
Collaborator Author

https://docs.rs/toml_edit/latest/toml_edit/ may be interesting, as it could allow us to edit the config in place.
This + the ability to potentially reload the config could vastly improve the UX for new-users and make iterating on ones config less tedious.
We still have to look into how to wire it up with an actual config crate though. Maybe we can combine it with config-rs? More of a note to self

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

No branches or pull requests

2 participants