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

Configuration File Support #47

Open
BebeSparkelSparkel opened this issue May 8, 2023 · 8 comments
Open

Configuration File Support #47

BebeSparkelSparkel opened this issue May 8, 2023 · 8 comments

Comments

@BebeSparkelSparkel
Copy link
Contributor

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. BebeSparkelSparkel@58ccaa7?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 to State. One poor solution I have thought of is changing State to something like

type State = [Item]
data Item
  = ItemUnparsed String
  | ItemParsed Dynamic

which allows preparsed data to be passed through.

Do you have any thoughts on how to accomplish this?

@SamuelSchlesinger
Copy link
Owner

Not sure I agree config files belong in the backtracking way parsing works with commander-cli

@BebeSparkelSparkel
Copy link
Contributor Author

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.

@SamuelSchlesinger
Copy link
Owner

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?

@BebeSparkelSparkel
Copy link
Contributor Author

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

@SamuelSchlesinger
Copy link
Owner

Interesting, yeah I mean if there's a widely used tool that has that behavior I'm open to a patch to support it.

@BebeSparkelSparkel
Copy link
Contributor Author

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.

@SamuelSchlesinger
Copy link
Owner

I feel like there's a world where state is modular, I'd have to take a hack at it though.

@SamuelSchlesinger
Copy link
Owner

Thinking at this again, I feel like configuration files being part of backtracking might be likely to create confusion among newer users.

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

2 participants