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

"set" array support #10

Open
jayvdb opened this issue Oct 24, 2022 · 3 comments
Open

"set" array support #10

jayvdb opened this issue Oct 24, 2022 · 3 comments

Comments

@jayvdb
Copy link

jayvdb commented Oct 24, 2022

As noted on the README, it isnt possible to set a key to be an array value, i.e. foo = ["bar"]

@gnprice
Copy link
Owner

gnprice commented Dec 4, 2022

#16 is a related issue, for setting ints and bools (as well as the existing strings.)

@gnprice
Copy link
Owner

gnprice commented Dec 4, 2022

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:

  • make setting arbitrary arrays possible;
  • make setting common kinds of arrays easy, and amenable to nice clean code.

Gauging the second part of that requires a guess as to what's common, which is where seeing a concrete use case comes in.

@lpil
Copy link

lpil commented Jan 9, 2024

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.

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

3 participants