-
Notifications
You must be signed in to change notification settings - Fork 235
Command-line configuration #64
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
Comments
A close integration with clap would definitely be a neat thing to have. |
what are your thoughts on this integration, should it be like multiple --conf key=value parameters passed through the command line which will override the values in the config |
If possible, it'd be great to reuse the names of fields in the struct, or allow them to be set via macros, so they can be used directly as flags (e.g. |
sure will figure out how to do it through macros, still new to rust :) https://github.com/tanujitghosh/config-rs/blob/issue-64/src/config.rs . - merge_args() |
An integration with Clap will be the way to go in my opinion too. Did you start working on that? Otherwise, I might give it a shot. |
It seems to me This would also allow the programmer to declare a single It should be possible to do a poor man's version of this already by implementing |
Are there any updates on this? Are there recommendations on how to use |
This project presently has no active maintainer AFAIK. I would be reluctant to adopt a crate for a new project when maintenance / development is halted. I may eventually have time to assist with review and merging of contributions, but I'm not able to commit to a proper maintainer role here, nor do I have the ability to publish a new release I think even if I assist with PRs in future. Despite the crates popularity, it's unclear when/if a new maintainer will arrive. You may want to look into other alternatives? |
I rigged something up that supports jq syntax via the jaq crate Rigged something up quick for my application. I implement it two different ways. One uses the set_override builtin to this crate. The second way pulls in jaq. It supports any transform jq does, which has slightly different syntax I am able to do things like This satisfies my desire to completely expose the config to the cli. Now I'm wondering how this can be cleaned up, and whether there is a nice abstraction to be had with clap sub-commands.
EDIT: link to cleaned up version https://github.com/blueforesticarus/goontunes2/blob/b73a4a9d90322aee223046893fddbc4bac73c719/src/config.rs |
Would you consider adding CLI support? A scenario I'm thinking of would work very nicely if you could override most/all of the config from CLI input, and it seems redundant to use clap to find the config file, get the contents of the config file, and then clobber those values with CLI inputs where they exist.
In the C# world, I'd add the https://www.nuget.org/packages/Microsoft.Extensions.Configuration.CommandLine/ package, which would then allow inputs in a number of forms, which would then override the config file settings depending on precedence.
The text was updated successfully, but these errors were encountered: