crudini icon indicating copy to clipboard operation
crudini copied to clipboard

Editing matomo config with same-key lists

Open alex1701c opened this issue 7 months ago • 4 comments
trafficstars

Hello, I'd like to edit the following file using this command line utility: https://github.com/matomo-org/matomo/blob/e2cbee6a285fbaf38bf752d1b80666a485883e38/config/global.ini.php#L1285

However, I am unable to append an entry in the same format.

Using crudini --set --list --list-sep= dummyfile.ini PluginsInstalled PluginsInstalled[] NewPlugin, I would get something like the following: PluginsInstalled[] = Installation NewPlugin. However, I want the NewPlugin to be on a new line.

Are there any plans to support something like this`? It would be really nice to be able to utilize this tool for this usecase!

alex1701c avatar Mar 27 '25 12:03 alex1701c

This was mentioned at https://github.com/pixelb/crudini/issues/10#issuecomment-168159621 where we might have --list-sep=PHP to support this. (For my ref, using a more general --list-sep=REPEAT to support this would need to explicitly specify the trailing [] when setting new items to use that php format, so might be too messy). Another thing to consider if implementing this, is if leveraging implicit --list-sep='$\n' to implement this, then that might preclude multiline entries. In summary this is quite awkward

pixelb avatar Mar 27 '25 13:03 pixelb

This was mentioned at https://github.com/pixelb/crudini/issues/10#issuecomment-168159621 where we might have --list-sep=PHP to support this.

That sounds pretty great from what I can tell.

In summary this is quite awkward

Yeah, I understand. Is there any chance sth. like the above may be implemented in the near future?

alex1701c avatar Mar 27 '25 14:03 alex1701c

I'll see what I can do for the next release

pixelb avatar Mar 28 '25 13:03 pixelb

Great, thank you!!

alex1701c avatar Mar 30 '25 14:03 alex1701c