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

std.manifestIni should support repeated keys #386

Closed
anguslees opened this issue Oct 12, 2017 · 2 comments
Closed

std.manifestIni should support repeated keys #386

anguslees opened this issue Oct 12, 2017 · 2 comments

Comments

@anguslees
Copy link
Contributor

See for example, systemd ini files where things like this are common:

[Service]
Environment=FOO=bar
Environment=BAZ=xyzzy

Perhaps this could be implemented by expanding a jsonnet key=array into repeated keys, rather than the current blunt "key=std.toString(value)" behaviour.

@sparkprime
Copy link
Member

sparkprime commented Oct 13, 2017

Is this a standard feature of INI files? The wiki page doesn't mention it. https://en.wikipedia.org/wiki/INI_file

To be clear, you propose:

std.manifestIni({
    main: { a: ["1", "2"] },
    sections: {
        s2: {p: ["yes", ""]},
    }
})

to be:

a = 1
a = 2
[s2]
p = yes
p = 

@sparkprime
Copy link
Member

sparkprime commented Oct 13, 2017

I misspoke:

Duplicate names
Most implementations only support having one property with a given name in a section. The second occurrence of a property name may cause an abort, it may be ignored (and the value discarded), or it may override the first occurrence (with the first value discarded). Some programs use duplicate property names to implement multi-valued properties.

Interpretation of multiple section declarations with the same name also varies. In some implementations, duplicate sections simply merge their properties together, as if they occurred contiguously. Others may abort, or ignore some aspect of the INI file.

OK this seems fine then.

sparkprime added a commit to sparkprime/jsonnet that referenced this issue Oct 31, 2017
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

2 participants