I’m building an editor extension that needs to run a snippet of code with the current dune project as a dependency. For example, suppose I’m working in a library named Foo on a module named Bar. I need to run a little script that calls Foo.Bar.run () and saves the output. A messy option is to do something like
echo "Foo.Bar.run ()" | dune utop
but then I’d need to parse the output out of the utop output. Similarly, I could create a new executable and just call dune exec but then the user of my editor tool would need to see the generated file.
Is there an easy way to do this?