ceejbot / tomato

🍅 A command-line tool to get and set values in toml files while preserving comments and formatting
Other
21 stars 1 forks source link

Adds support for appending values to arrays #1

Closed nullsauce closed 12 months ago

nullsauce commented 2 years ago

Hey there. Thanks for sharing this super handy tool! I'd like to use it for editing toml configuration files inside container builds and noticed there was no support for appending values to arrays, so I've added it along with a few tests.

You can now append <KEY> <VALUE> which returns the previous array or nothing if it didn't exist. Errors if the key exists but is not an array.

I feel like the code could be factored here and there as this creates a few redundancies but I preferred to keep the diff as simple as possible rather than starting shaving the yak. Hope this is fine.

Let me know if there's anything else I should do. Cheers!