Refactor: tools: Split up cli_resource_update_attribute.
The initialization code and the block that deal with element attributes
can be kept in the main function because both only ever need to be run
the once. Everything else moves into a new static function that does
all the hard work.
No code changes yet.