I have this code in yaml
cpu-affinity:
- management-cpu-set:
cpu: [ 0 ] # include only these CPUs in affinity settings
Now I am using yq version4 I want to modify this cpu array from [0] to a given list by user input and reset it back to [0] if needed.
In one way I can do like iterating and adding like cpu[0]=x , cpu[1]=y , etc But then to delete it I have to run del command for every element to reset it to cpu :[0]
Is there any way to directly replace entire array in one command with user input and reset it back to [0]