(Genuine question, I've been trying to find reliable, well documented, robust patterns for doing this for years! I need it across macOS and Linux and ideally Windows too. Preferably without having to run anything as root.)
https://github.com/microsoft/litebox might somehow allow it too if a tool can be built on top of it, but there is no documentation.