Open jayvdb opened 2 years ago
Thanks @jayvdb for filing this!
I think the main question for how this should work is what the command-line interface for it should look like.
Do you have a context where you'd like to use toml set
to set an array value? A concrete use case would be a helpful ingredient for thinking through the interface.
As illustrated in the TOML spec, a TOML array can contain a wide variety of types of values, and can mix types:
nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
mixed_floats_and_ints = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
contributors = [
"Foo Bar <foo@example.com>",
{ name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" }
]
So ideally the interface here would both:
Gauging the second part of that requires a guess as to what's common, which is where seeing a concrete use case comes in.
Yes please!
As for the syntax, I would parse the argument as toml and use as toml if it can be parsed. A --raw flag could be used to disable this.
As noted on the README, it isnt possible to set a key to be an array value, i.e.
foo = ["bar"]