Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Improving the CLI #2097

Closed
ghost opened this issue Apr 29, 2019 · 11 comments
Closed

[RFC] Improving the CLI #2097

ghost opened this issue Apr 29, 2019 · 11 comments

Comments

@ghost
Copy link

ghost commented Apr 29, 2019

I propose to change the CLI as follow:

  • when the first argument starts with a letter, it is always considered as a command name (as now)
  • otherwise, the build command is implicitly assumed if at least one ancestor directory contains a dune, dune-project or dune-workspace file

The idea is to allow the user to type simply dune or dune @all rather than dune build or dune build @all. The first rule prevents ambiguities and the condition on the second rule is to make sure that dune doesn't crawl the whole hard drive when called outside a project.

@ghost ghost mentioned this issue Apr 29, 2019
@trefis
Copy link
Collaborator

trefis commented May 1, 2019

Does that imply that dune --help would show me the manpage of the build command instead of the manpage listing the available commands?

@ghost
Copy link
Author

ghost commented May 1, 2019

That's a good point. I don't think it should, it should be the same as the current dune --help. However, we should extend this man page to document the new behaviour.

@ksromanov
Copy link

ksromanov commented May 2, 2019

I checked selection of OPAM packages (1472 packages, Github-only), out of them:

  1. 126 use dune only
  2. 643 use make only
  3. 451 use both make and dune

Among these 451, default Makefile targets about 445 are various flavors of dune build <args>. Most common are:

  • dune build (236)
  • dune build @install (74)
  • dune build @install --profile=release (16)
  • dune build --profile release (10)
  • various jbuilder build ... (20, half of which have --dev, half - not).

These are rough numbers, since I discarded about 1/3 of repos (there was 2288 repos in OPAM in total).

@hcarty
Copy link
Member

hcarty commented May 3, 2019

@ksromanov Does dune exec do what you're looking for?

@avsm
Copy link
Member

avsm commented May 3, 2019

I'm generally in favour of simpler consistency for the CLI, subcommands since higher level tools (e.g. VSCode rules, or Makefiles) invoke dune directly. For them, calling dune build @all isn't a burden at all.

@ksromanov
Copy link

ksromanov commented May 3, 2019

@hcarty

@ksromanov Does dune exec do what you're looking for?

Unfortunately it does not :-(. But yes, you are right - I missed exec. Updating comment above. The idea is to reduce command-line boilerplate.

@ghost
Copy link
Author

ghost commented May 3, 2019

@ksromanov I feel like we are diverging from the original conversation. Please open a separate ticket to discuss improvements to dune exec.

@Chris00
Copy link
Member

Chris00 commented May 4, 2019

If the motivation is to type less, wouldn't a shell completion mode be better?

@ghost
Copy link
Author

ghost commented May 5, 2019

That's a fair point. In particular, I wonder how much we would still want the shorter command line if we add shell completion. Linking the ticket for shell completion: #126

@rgrinberg
Copy link
Member

I also think that shell completion would be far more effective and that adding any kind of cleverness is gratuitous. If we make a few straight forward improvements to polling mode, that would cut down on the dune invocations by 90% for me. And as Anil said, proper integration would make this even less relevant.

@rgrinberg
Copy link
Member

After a lively discussion, it's time to make a decision. I regret to inform the enthusiasts of this issue that you will be required to input the 6 additional keystrokes to get dune to build something. My sincerest apologies.

@rgrinberg rgrinberg closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants