Open BebeSparkelSparkel opened 1 year ago
Not sure I agree config files belong in the backtracking way parsing works with commander-cli
Something that I have found to be very useful is being able to have cli arguments overpower with config file settings. I do appreciate your non intermixing of config opinion because there is not a good way merging differing structures well.
I guess the way I'd include a config is by a path parameter or an environment variable, but maybe I'm missing something useful. Is there a good example where this was quite helpful?
This isn't a great example but bitcoind allows for this behavior https://manpages.debian.org/testing/bitcoind/bitcoind.1.en.html
The conf file field can be superseded by the cli parameter
Interesting, yeah I mean if there's a widely used tool that has that behavior I'm open to a patch to support it.
I currently do not have a good design for this. Do you have any thoughts on the limited expressiveness of the state? The Parameter Sections #48 could be a solution for nested structures.
I feel like there's a world where state is modular, I'd have to take a hack at it though.
Thinking at this again, I feel like configuration files being part of backtracking might be likely to create confusion among newer users.
It seems natural to allow intermixing of command line parameters and configuration file parameters.
I have not figured out a good way of implementing this yet but I have written a crude start. https://github.com/BebeSparkelSparkel/commander-cli/commit/58ccaa7668f37faa46d264097291ae977dafb779?diff=unified#diff-0fdf6337b7344d0659520693ed886d16bcaa1726b984e9a032da849ed05c61e7
One of the problems is that the structure and parsing work already completed to create
conf
is lost in the merge back toState
. One poor solution I have thought of is changingState
to something likewhich allows preparsed data to be passed through.
Do you have any thoughts on how to accomplish this?