Why do I need to specify a NAME when running `dune init proj NAME` instead of initializing a project in my current directory?

Fairly new to OCaml still. Reading the quickstart I’ve always just done as they say (as in my title), but it always feel like added friction to not be able to initialize a project in place. So I’m curious why I have to specify a subdir for dune projects.

For context: I find that I’m usually creating a repo on github, cloning it down, and then trying to initialize my dune project. This usually ends up with me running dune init proj MY_PROJ inside my git repo, which creates a subdirectory of the same name as the repo. Then I just copy the contents up to my git repos root, and delete the now empty MY_PROJ/

It would be sweet if it worked like nix flake init

I’d love to hear what the intended workflow is here and maybe why its the way it is. If the answer is “thats just the way it is” I might be motivated to take this to a github issue, but I’d like some noob-check validation here I suppose…


Yes, this would be a good feature to add.


The workflow I use is

dune init proj foo
cd proj
git init

Then at some later date I may end up pushing the repo onto github, or a different forge. I agree that it should support project set up in existing dirs tho (as per my comments on the issue :slight_smile: ).

Regarding your title question:

Why do I need to specify a NAME

This is so that the various fields like the (package (name ...)) in dune-projet and the (library (name ...)) in lib/dune have meaningful value rather than a placeholder. That said, there are other values that take a place-holder, and we could fall back to a placeholder or try to infer the name from the parent directory.