[OpenWrt-Devel] Possible extensions to uci cli

Sergii Kalchuk Sergii.Kalchuk at devolo.de
Mon Apr 30 07:25:19 EDT 2018

Hi all,

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.

Best regards,
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list