Closed kurtbuilds closed 1 year ago
Thanks for sending this!
For cross-reference: the second commit here is about making toml set
able to actually edit the file in place, #7. See discussion there about what the interface should be: https://github.com/gnprice/toml-cli/issues/7#issuecomment-1336105312
I've just pushed an implementation of --raw
/-r
, as 3f91f138c. I found I wanted to implement it a bit differently from this version -- in particular, to match on the toml_edit::Item
to see if it's a string, rather than serialize to JSON first and then match on the serde_json::Value
to see if that's a string -- and I also added docs for it in the --help
and the README.
I also noticed a useful cleanup in the second commit: making read_parse
take a reference, which is a good improvement to the code independently of the other changes there which make it necessary. So I broke that out as its own commit 04e0a6daa and pushed that.
Let's leave the rest of the --in-place
implementation for a separate PR, after discussing the question at https://github.com/gnprice/toml-cli/issues/7#issuecomment-1336105312 of whether it should instead become the default behavior.
Thanks again for this contribution! In addition to that cleanup in 04e0a6daa, this PR was useful feedback for me that --raw
was a feature people do concretely want, so it was a helpful prompt for me to go and implement it :slightly_smiling_face:
Some example usage based on this toml file: