2018-04-30 11:25:19 UTC
let's consider the scenario of transferring configuration from one device to another. With uci cli, options can be nicely transferred by using something similar to
value="$( uci get option_src)" ; uci set option_target="$value"
For lists, it's however not that elegant anymore. For the mentioned scenario, it would be nice to be able to handle the lists in the same way as the options in the example above, e.g. using the notation
value="$( uci get list_src)" ; uci set list_target="$value"
Addressing individual list elements with e.g. 'uci get list[i]' with i=-1,0,... similar to sections could be another consistent extension.
The introduction of the notation with '' should not break any previous uses of the tool.
Clearly, there are workarounds to work with lists, e.g. with json processing in ubus or with helper functions in /lib/functions.sh. But if enough people in the openwrt community share the view on the benefits of the extensions or perhaps come up with other use cases, it could be worth implementing it in cli as well.