#280·dasel

XML array with one member is not detected as array

Author: yorickdowneCreated Dec 28, 2022Updated Dec 28, 2022
Labelsbug

Describe the bug

dasel v2.0.2. This is present in 1.x as well.

Create array with one entry: dasel put -f NLog.config -r xml -w xml -t json 'nlog.rules.logger' -v '{"-name":"JsonWebAPI.Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService","-maxlevel":"Error","-final":" true"}'

And try to append: dasel put -f NLog.config -r xml -w xml -t json 'nlog.rules.logger.[]' -v '{"-name":"JsonWebAPI*","-minlevel":"Error","-writeTo":"auto-colored-console-async","-final":"true"}'

results in error: Error: cannot use append selector on non slice/array types

Expected behavior

Dasel can append to an array with just one member

Additional context

Workaround: Create an array with two members first. dasel put -f NLog.config -r xml -w xml -t json 'nlog.rules.logger' -v '{"-name":"JsonWebAPI.Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService","-maxlevel":"Error","-final":"true"}{"-name":"JsonWebAPI*","-minlevel":"Error","-writeTo":"file-async","-final":"true"}'

The same append will then work. NLog.config.txt