sagiegurari / cargo-make

Rust task runner and build tool.
https://sagiegurari.github.io/cargo-make/
Apache License 2.0
2.6k stars 126 forks source link

`--list` flag #848

Closed yoav-lavi closed 1 year ago

yoav-lavi commented 1 year ago

Feature Description

Add a --list flag to list the available tasks with their description (this would act like --list-all-steps but only show proper tasks rather than things like init and end and would be more discoverable / intuitive (IMO) than using --list-all-steps for this purpose)

Note: this could possibly filter by platform / condition (or just show unavailable tasks as grey / crossed out)

e.g.

cargo make --list
Tasks
----------
clippy             Runs Clippy
clippy-nightly     Runs Clippy on the nightly toolchain
test               Runs cargo-nextest
sagiegurari commented 1 year ago

I didn't fully understand the difference between the current cli capability apart of not showing init/end tasks and few others that can be hidden if they are private

yoav-lavi commented 1 year ago

In my mind it'd be

--list-all-steps - a more detailed output of possible steps regardless of if they're user runnable --list - the answer to the question "what tasks can I use?"

As in --list is more of a convenience to be able to quickly see what you can run, in which case --list-all-steps would be a bit noisy

yoav-lavi commented 1 year ago

Although I see --list-all-steps does filter out private=true tasks so the difference isn't huge. Perhaps just --list as an alias for --list-all-steps would be nice since you don't necessarily connect all-steps with "list the tasks I can run" immediately (could be understood as "list all the steps for the current task I'm running")

sagiegurari commented 1 year ago

@yoav-lavi going back to this issue, so you want list-steps to show steps that will be executed if you run task X for example? isn't that '--print-steps '? i'm trying to understand what is really missing and i'm just not sure

sagiegurari commented 1 year ago

@yoav-lavi i've added a new flag (--hide-uninteresting) for both list cli commands so hooks (pre-/post-/init/end/empty) are excluded from the output. I hope this would resolve your issue. you can try it out in the dev branch 0.36.8

sagiegurari commented 1 year ago

@yoav-lavi this is now officially released. if you feel something more should be added here, please open a new issue and lets talk about the gap

yoav-lavi commented 1 year ago

Thanks @sagiegurari! This is helpful. I'd personally suggest a convenience alias for --list-all-steps --hide-uninteresting as well, since it's likely to be something users want to run periodically / on first use

sagiegurari commented 1 year ago

you can set that alias in your bashrc :)

yoav-lavi commented 1 year ago

Sure, I meant as a builtin alias, I'll be doing so regardless :)