-
Notifications
You must be signed in to change notification settings - Fork 470
Initialize new project in current directory #9209
Description
Desired Behavior
I would like to be able to run dune init proj NAME and have it create my project in place (ie, not a subdirectory ./NAME).
Current Behavior / Problem Space
Currently dune init proj NAME requires a NAME parameter and creates a subdirectory. Every time I've used dune to initialize a project, I am starting from an empty git repo, and running dune from the repo's root. This creates the dune project nested down a level which I don't want. I work around this by moving the contents of the newly created subdirectory up to the repo's root, and then deleting the now empty ./NAME directory that was created by dune. This is uncomfortable for someone who's new to the language and is spinning up new projects that are very small in scope just to learn (ie: me).
Example
Intended functionality would be similar to nix flake initi.
Example workflow for initializing project:
# Create a new bare repo on github.com
git clone my/repo
nix flake init # included to show how I expected dune to work
dune init proj MY_PROJ --in-place
# write some ocaml
Initial Considerations
My initial intuition when using dune was just to run dune init proj (omitting the name parameter) as this is how other tooling like nix flake init works. Because the name parameter gets used for more then just the path in which to create the dune project, my suggestion is to add an optional flag that specifies that I want my dune project created in-place. Something like --in-place is narrow in scope and behavior, or --path=/my/custom/path which could give more flexibility to the tool at the cost of intuitiveness.