-
Notifications
You must be signed in to change notification settings - Fork 413
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
feature: dune show targets and dune show aliases #7770
Conversation
cd5c97c
to
565e0f4
Compare
@emillon Since this is a relatively straightforward addition, it could perhaps be considered for 3.8. Edit: Actually, nevermind. The scope has grown a bit so probably worth waiting to next major version. |
Does it make sense to display aliases as well? |
@nojb I have something similar giving hints to aliases: #7004. However due to the way we lookup aliases we have to do it for all contexts at the same time. It shouldn't be too difficult to add an I don't think I will be able to do it in this PR however, since it will need some more refactoring of how we handle aliases in bin. I'll open a feature request when this is merged however. |
1e936bf
to
6fc8026
Compare
@nojb Actually I went ahead and implemented an I'm actually unsure if we want this in the targets command or we wish to have a separate command for displaying aliases. In any case if we are undecided we can always drop that commit. |
I think so, yes, thanks! What I had in mind is a beginner; I would imagine most of the time such an user will be more interested in invoking an alias than a target file. |
That's a very useful command but I feel like it shouldn't be top-level. Don't we usually put these things under I don't like the name "describe" and would prefer something like |
|
@nojb Sounds like a great plan to me! |
@Alizter If we go with the |
I don't like the name describe either, but I don't like to have two names for the same thing either. I'd rather teach users one bad name rather than a good name and a bad name. |
@rgrinberg We can deprecate the bad name (error) and point to the new good name. I've started a proposal in #7784, |
We shouldn't. The disturbance caused by this deprecation far outweighs whatever benefit can be gained from it. Going through a deprecating cycle is a ton of churn for both the developers and the users. At best, we can introduce an alias like we did for |
Even if we don't aggressively deprecate the existing commands and just alias them under new names, I think that, in terms of CLI usability, it would still be an improvement migrating to |
Before we deprecate (hard or soft) Also, it would be a very poor experience to partition our subcommands into |
6fc8026
to
116dfde
Compare
Regarding this PR: I've added a show subcommand and added aliases and a subcommand of that. So we have I'm drafting this PR for the time being so we can continue to discuss how best to group the commands. My thinking is that we really want to add these to Also |
I just want to say that this feature was requested internally (there was particular interest for |
test/blackbox-tests/test-cases/show/dune-targets-simple.t/run.t
Outdated
Show resolved
Hide resolved
Externally, it's easy to make progress. We just follow existing conventions. Internally, we no longer import the command line from upstream. Nor do we have an existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test generated targets (not worth investigating at this time)
What are generated targets?
Nevermind, I was confused about something when I wrote it. |
a37f7ec
to
4480d89
Compare
4480d89
to
dc39ba6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started doing some cleanups and realized there's a little too much copy pasting between aliases
and targets
for my tastes. Can you factor the code out?
@rgrinberg sure, I'll have a look over the weekend. |
@rgrinberg I've factored the common code out, I'm not so sure about the API yet. I think there is some more cleanup we can do. |
6c1bbe8
to
31e3e21
Compare
4114994
to
149a805
Compare
I've just added a user error for when a directory is outside of the project. |
149a805
to
4a06518
Compare
Perhaps, |
It could also be distinguished via some visual cue in Let's save that for a subsequent PR though. |
Sure, happy for this to go to a separate PR. |
4a06518
to
01f4801
Compare
Add a `dune show targets` and `dune show aliases` command for showing targets and aliases in a directory like `ls`. fix ocaml#265 Co-authored-by: Rudi Grinberg <me@rgrinberg.com> Signed-off-by: Ali Caglayan <alizter@gmail.com>
01f4801
to
449d834
Compare
CHANGES: - Validate file extension for `$ dune ocaml top-module`. (ocaml/dune#8005, fixes ocaml/dune#8004, @3Rafal) - Include the time it takes to read/write state files when `--trace-file` is enabled (ocaml/dune#7960, @rgrinberg) - Add `dune show` command group which is an alias of `dune describe`. (ocaml/dune#7946, @Alizter) - Include source tree scans in the traces produced by `--trace-file` (ocaml/dune#7937, @rgrinberg) - Cinaps: The promotion rules for cinaps would only offer one file at a time no matter how many promotions were available. Now we offer all the promotions at once (ocaml/dune#7901, @rgrinberg) - Do not re-run OCaml syntax files on every iteration of the watch mode. This is too memory consuming. (ocaml/dune#7894, fix ocaml/dune#6900, @rgrinberg) - Remove some compatibility code for old version of dune that generated `.merlin` files. Now dune will never remove `.merlin` files automatically (ocaml/dune#7562) - Add `dune show env` command and make `dune printenv` an alias of it. (ocaml/dune#7985, @Alizter) - Add additional metadata to the traces provided by `--trace-file` whenever `--trace-extended` is passed (ocaml/dune#7778, @rleshchinskiy) - Extensions used in `(dialect)` can contain periods (e.g., `cppo.ml`). (ocaml/dune#7782, fixes ocaml/dune#7777, @nojb) - Allow `(include_subdirs qualified)` to be used when libraries define a `(modules ...)` field (ocaml/dune#7797, fixes ocaml/dune#7597, @anmonteiro) - `$ dune describe` is now a command group, so arguments to subcommands must be passed after subcommand itself. (ocaml/dune#7919, @Alizter) - The `interface` and `implementation` fields of a `(dialect)` are now optional (ocaml/dune#7757, @gpetiot) - Add commands `dune show targets` and `dune show aliases` that display all the available targets and aliases in a given directory respectively. (ocaml/dune#7770, grants ocaml/dune#265, @Alizter) - Allow multiple globs in library's `(stdlib (internal_modules ..))` (@anmonteiro, ocaml/dune#7878) - Attach melange rules to the default alias (ocaml/dune#7926, @haochenx) - In opam constraints, reject `(and)` and `(or)` with no arguments at parse time (ocaml/dune#7730, @emillon) - Compute digests and manage sandboxes in background threads (ocaml/dune#7947, @rgrinberg) - Add `(build_if)` to the `(test)` stanza. When it evaluates to false, the executable is not built. (ocaml/dune#7899, fixes ocaml/dune#6938, @emillon) - Add necessary parentheses in generated opam constraints (ocaml/dune#7682, fixes ocaml/dune#3431, @Lucccyo)
CHANGES: - Validate file extension for `$ dune ocaml top-module`. (ocaml/dune#8005, fixes ocaml/dune#8004, @3Rafal) - Include the time it takes to read/write state files when `--trace-file` is enabled (ocaml/dune#7960, @rgrinberg) - Add `dune show` command group which is an alias of `dune describe`. (ocaml/dune#7946, @Alizter) - Include source tree scans in the traces produced by `--trace-file` (ocaml/dune#7937, @rgrinberg) - Cinaps: The promotion rules for cinaps would only offer one file at a time no matter how many promotions were available. Now we offer all the promotions at once (ocaml/dune#7901, @rgrinberg) - Do not re-run OCaml syntax files on every iteration of the watch mode. This is too memory consuming. (ocaml/dune#7894, fix ocaml/dune#6900, @rgrinberg) - Add `--all` option to `dune rpc status` to show all Dune RPC servers running. (ocaml/dune#8011, fix ocaml/dune#7902, @Alizter) - Remove some compatibility code for old version of dune that generated `.merlin` files. Now dune will never remove `.merlin` files automatically (ocaml/dune#7562) - Add `dune show env` command and make `dune printenv` an alias of it. (ocaml/dune#7985, @Alizter) - Add additional metadata to the traces provided by `--trace-file` whenever `--trace-extended` is passed (ocaml/dune#7778, @rleshchinskiy) - Extensions used in `(dialect)` can contain periods (e.g., `cppo.ml`). (ocaml/dune#7782, fixes ocaml/dune#7777, @nojb) - Allow `(include_subdirs qualified)` to be used when libraries define a `(modules ...)` field (ocaml/dune#7797, fixes ocaml/dune#7597, @anmonteiro) - `$ dune describe` is now a command group, so arguments to subcommands must be passed after subcommand itself. (ocaml/dune#7919, @Alizter) - The `interface` and `implementation` fields of a `(dialect)` are now optional (ocaml/dune#7757, @gpetiot) - Add commands `dune show targets` and `dune show aliases` that display all the available targets and aliases in a given directory respectively. (ocaml/dune#7770, grants ocaml/dune#265, @Alizter) - Allow multiple globs in library's `(stdlib (internal_modules ..))` (@anmonteiro, ocaml/dune#7878) - Attach melange rules to the default alias (ocaml/dune#7926, @haochenx) - In opam constraints, reject `(and)` and `(or)` with no arguments at parse time (ocaml/dune#7730, @emillon) - Compute digests and manage sandboxes in background threads (ocaml/dune#7947, @rgrinberg) - Add `(build_if)` to the `(test)` stanza. When it evaluates to false, the executable is not built. (ocaml/dune#7899, fixes ocaml/dune#6938, @emillon) - Add necessary parentheses in generated opam constraints (ocaml/dune#7682, fixes ocaml/dune#3431, @Lucccyo)
Add new
dune show targets
anddune show aliases
commands that work similarly tols
displaying targets and aliases respectively in the current directory or instead any directories given as arguments. They do not show targets or aliases in subdirectories or inside directory targets. Directory targets will be printed with a trailing path separator to distinguish them however.and continuing
part of general effort in:
This is quite useful in cram tests to make sure dune is willing to produce the correct targets.
/