-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adds support of usage of a TOML "dotfile" config file in the user's homedir (In-Progress) #19
Conversation
Thanks for the contribution! Can you make a separate module for this new feature? Simply declare the module inside pub mod config; And then add your code inside Happy coding! |
Yes, for this feature the best practice would be to wrap the entire implementation in a separate module. |
I have marked this pr as ready for review; however, if you are satisfied with the result, do not merge. I still have to comment the code. |
Just letting you know that I merged another branch to Also, I added linting check to the GitHub Actions workflow. Make sure you run Thanks! |
While you're still working on this: For the sake of freedesktop convention, is it OK to keep the toml file inside the config directory? You can call the For example, on Linux, Hope that's clear enough. Feel free to ask me anything! 😄 |
Have completed all the required changes, now file is getting generated based on .env inside of homedir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! The new modules looks nice and neat. I also like the custom enum for error handling
There are some issues though:
First I noticed that if the config file exist but is empty, the program will just panic:
thread 'main' panicked at src/config.rs:102:22:
index not found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Second, if the config file doesn't exist, the generated file uses inline tables
instead of tables
. It doesn't affect the functionalities, but is less readable, which is important for config files. Here's the generated file:
api = { base = "...", key = "..." }
There are some other issues which I'll discuss in code review
…fig dir, instead of home dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! We're almost there. Just some trivial details
Description
This is a draft pull-request that allows us to communicate along with arrival of the new commits.
What's new ?
Cargo.toml
file updated, it acquired new dependency called "TOML"Parses TOML file and uses data out there
Closes #18