- From: Peter Fern <
>
- To: "
Dev" <
>
- Subject: [chef-dev] Re: How to represent nested attributes
- Date: Tue, 08 Jul 2014 16:18:52 +1000
On 08/07/14 07:09, Noah Kantrowitz wrote:
Something that could maybe do with a bit of standardization. The issue is given some nested
hashes, how do you indicate a specific key. The attribute declaration and the new attribute
whitelists use a "/" separator, most knife command line options use a "." and
partial searches use none and require a real array. Thoughts?
I really wish this was standardized. The fact that there are at least
three ways of doing this is a real problem, and so are characters like
'.' and '_', that are frequently included in key names. My vote would
be for '/' separated, or '[array][ish][notation]' because that largely
does away with the conflicting separator problem, but if we could at
least be consistent within knife, that would be way less insane than
what we're doing now.
When I wrote knife-attribute[1][2] I used the dot notation because it's
common across all the core knife commands except search, and because
that's what's supported by GenericPresenter#extract_nested_value, but
#extract_nested_value doesn't even support escaping, so if you encounter
something with periods in the key, you're completely boned. It may be
worth my while to submit a PR to at least allow escaping there, now that
it comes to mind again.
Pete
[1]
https://github.com/pdf/knife-attribute
[2] OT: It might be a good idea to have a 'knife' section on the
supermarket to act as a central repository for discovering knife plugins
(beyond `gem search knife-`).
Archive powered by MHonArc 2.6.16.