ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 407 forks source link

shell completion #126

Open copy opened 7 years ago

copy commented 7 years ago

Shell completion, similar to opam's would be useful and remove the need to write Makefiles in order to remember jbuilder's commands and build targets. I.e., when you type jbuilder build <tab>, it should list all build targets and jbuilder <tab> should list jbuilder's commands.

For reference, opam's completion scripts are here:

ghost commented 7 years ago

It seems to me that cmdliner could help generating the completion. Most of the information in these scripts is already present in the description of the command line built with cmdliner

copy commented 7 years ago

In that case, this issue is blocked by https://github.com/dbuenzli/cmdliner/issues/1.

ghost commented 7 years ago

I wouldn't say blocked, I'd welcome manually written scripts to support it. Although I'm not excited by the maintenance burden.

ghost commented 3 years ago

Some news about this feature request: we are now using our own fork of cmdliner.

So if someone wants to work on this feature, it is acceptable to implement the feature in our fork. This should be easier than submitting it upstream given that it only needs to work for Dune rather than for everybody.

arbipher commented 1 year ago

The links to the opam's complete script are invalid now.

I would also suggest a shell completion for dune exec but I am not sure whether it's feasible. e.g. I have an executable stanza hello for hello.ml. I expect $ dune exec he --(press TAB to complete)--> $ dune exec hello.exe rather than $ dune exec he --(press TAB to complete)--> $ dune exec hello.ml

Alizter commented 1 year ago

@arbipher We don't have any completion scripts in Dune at the moment, so when you do he -> hello,ml that is just your terminal completing to whatever is in the current directory. We are working on completion in #6377 but I don't think we have anything for dune exec at the moment planned.