Set default app for file type on Mac

Hi there,

We have 2 apps on our customers machines that can both open files with the same file extension. Is there any way via shell commands to set which application should be the default?

Essentially, I'm hoping to replicate Get Info > Open With > Change All using a shell script, but I just can't find a way of doing it. I thought lsregister might be the way, but no luck :frowning:

Thanks in advance!
Dave