buildtools
buildtools copied to clipboard
Buildozer: Add "key: value" to dict
I couldn't find any way to add a key/value pair to a dictionary attribute. Am I missing something or is this functionality simply not there?
It looks like there is a function DictionarySet in edit.go but no commandline trigger to use that in edit/buildozer.go
Feel free to add and send a PR
Which keyword would you prefer?
Maybe something like "dict_add"/"dict_replace"/"dict_move" similar to the list functionality?
@laurentlb -- thoughts?
This can be useful, indeed. Can describe more precisely the syntax you suggest?
The current functionality of add:
add <attr> <value(s)>: Adds value(s) to a list attribute of a rule. If a value is already present in the list, it is not added.
How I would expect dict_add to work:
dict_add <attr> <key> <value>: Adds a value at a certain key to a dict attribute of a rule. If a value is already present at this key in the dict, it is not added.
Currently I'm creating dict attributes by just using set and entering a dict in there, which works but isn't pretty. It also makes it awkward to edit dicts.
Great, looks good!
Any news on this?
Not from my side.
Great, I'll open a PR for this in a bit then! dict_add, dict_set, and dict_remove should cover all dict essentials?
Shouldn't this issue be closed now? It was implemented by PR#421.
@vladmos ☝🏻
Fixed by #421