Closed itornaza closed 5 months ago
Sounds good; no opposition.
Since I'm taking some time to consider the user interface aspects, it doesn't mean I'm the cleanest coder around. So, don't refrain from refactoring my mess until I get on the rails.
Could you open a PR with this setup and refactor the minimal example in the current main.rs
so we can see where each stuff goes?
I am doing the changes and opening the PR soon. I hope I don't mess things up for a change!
Just to port my comment from #12
Organization for commands in src/constants.rs
looks nice
Maybe later we can have each command set in a separate module instead of one file in commands.rs
Each command should be a clap struct containing all the parameters and flags available and implements a handle/run method to handle execution
I think you are right, the constants.rs is an overkill, enums are more clear. In the next code base update we drop them out!
I would like us to consider the structure of the project and how modules and files are to be organized.
As you have already noticed, I like to have all string literals defined in the
constants.rs
so all typos and text replacements can be done through a single location and are not mixed up with the real code. Also, code that just assembles output like the interface can either be constructed in the constants be in another module likedisplay.rs
.In order to keep
main.rs
as clean as possible, I also like to include all command line parsing code in aparse.rs
module and all rpc set up from the user options in anrpc.rs
module. Finally, all of the command implementations can be included in acommands.rs
module.