feat(task): add --name-only flag to mise tasks ls#9435
Conversation
Outputs one task name per line with no padding, header, or description column, suitable for piping directly to fzf and similar tools without sed/awk cleanup. Conflicts with --json, --extended, --complete, --usage. Closes discussion #9434. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces a --name-only flag to the tasks ls command, enabling a simplified output of task names suitable for piping into other tools. The implementation includes updated documentation, new end-to-end tests, and the necessary CLI logic. Feedback focuses on ensuring the new flag is marked as global in both the Rust source and the usage definition files to maintain consistency with other output-related flags.
| #[clap( | ||
| long, | ||
| verbatim_doc_comment, | ||
| conflicts_with_all = ["json", "extended", "complete", "usage"] | ||
| )] |
There was a problem hiding this comment.
The --name-only flag should be marked as global = true to maintain consistency with other output-related flags in this struct (like --json and --extended). This ensures the flag is correctly categorized in help output and behaves consistently when used at different levels of the command hierarchy (e.g., mise tasks --name-only ls).
| #[clap( | |
| long, | |
| verbatim_doc_comment, | |
| conflicts_with_all = ["json", "extended", "complete", "usage"] | |
| )] | |
| #[clap( | |
| long, | |
| global = true, | |
| verbatim_doc_comment, | |
| conflicts_with_all = ["json", "extended", "complete", "usage"] | |
| )] |
| flag --complete help="Display tasks for usage completion" hide=#true | ||
| flag --hidden help="Show hidden tasks" global=#true | ||
| flag --no-header help="Do not print table header" global=#true | ||
| flag --name-only help="Only show task names, one per line. Useful for piping to fzf and similar tools." |
There was a problem hiding this comment.
| flag --complete help="Display tasks for usage completion" hide=#true | ||
| flag --hidden help="Show hidden tasks" global=#true | ||
| flag --no-header help="Do not print table header" global=#true | ||
| flag --name-only help="Only show task names, one per line. Useful for piping to fzf and similar tools." |
Greptile SummaryAdds a Confidence Score: 5/5Safe to merge — new output mode only; no task loading or execution logic is touched. All seven changed files are consistent: the Rust implementation is clean and follows existing patterns, conflicts are correctly declared for all three mutually-exclusive output modes, the intentional No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[mise tasks ls] --> B{self.complete?}
B -- yes --> C[complete: name:description format]
B -- no --> D{self.usage?}
D -- yes --> E[display_usage: full usage spec]
D -- no --> F{self.json?}
F -- yes --> G[display_json: JSON array]
F -- no --> H{self.name_only?}
H -- yes --> I[display_name_only: one name per line\ncalm_io::stdoutln!]
H -- no --> J[display: table with Name + Description]
K[--name-only] -. conflicts_with_all .-> L[--json]
K -. conflicts_with_all .-> M[--extended / -x]
K -. conflicts_with_all .-> N[--usage]
K -. NOT conflicted\nintentional .-> O[--complete hidden]
Reviews (6): Last reviewed commit: "Merge branch 'main' into claude/serene-m..." | Re-trigger Greptile |
Mark --name-only as global=true to match the other output flags on TasksLs (--json, --extended, --usage, etc.) so it's available at any level of the tasks command hierarchy. Drop --complete from conflicts_with_all because --complete is not a global flag, so a global flag referencing it panics clap when it propagates to sibling subcommands like `tasks info` that don't carry --complete. The runtime routing in run() picks --complete first anyway, so a stray combo just falls through harmlessly. Also add an e2e assertion that --name-only --usage is rejected. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
cli::tests::test_subcommands_are_sorted enforces alphabetical ordering of long-only flags within a clap command. --name-only sorts before --no-header, so move the struct field accordingly and regenerate the usage spec and docs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.4.24 x -- echo |
17.9 ± 0.9 | 16.8 | 33.3 | 1.00 |
mise x -- echo |
18.1 ± 0.4 | 16.9 | 19.3 | 1.01 ± 0.06 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.4.24 env |
17.6 ± 0.4 | 16.4 | 19.5 | 1.00 |
mise env |
17.9 ± 0.6 | 16.8 | 21.5 | 1.01 ± 0.04 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.4.24 hook-env |
18.1 ± 0.5 | 17.0 | 22.7 | 1.00 |
mise hook-env |
18.4 ± 0.4 | 17.4 | 20.6 | 1.01 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.4.24 ls |
18.9 ± 0.4 | 17.7 | 21.7 | 1.00 |
mise ls |
19.4 ± 0.4 | 18.2 | 22.4 | 1.02 ± 0.03 |
xtasks/test/perf
| Command | mise-2026.4.24 | mise | Variance |
|---|---|---|---|
| install (cached) | 119ms | 118ms | +0% |
| ls (cached) | 68ms | 68ms | +0% |
| bin-paths (cached) | 68ms | 68ms | +0% |
| task-ls (cached) | 712ms | 708ms | +0% |
### 🚀 Features - **(task)** add --name-only flag to mise tasks ls by @jdx in [#9435](#9435) ### 🐛 Bug Fixes - **(Dockerfile)** install copr-cli via dnf for better dependency management by @bestagi in [#9421](#9421) - **(aqua)** drop empty-releases fallback to tags by @jdx in [#9443](#9443) - **(docs)** fix theme flicker on docs by @vhespanha in [#9427](#9427) - **(lockfile)** update global lockfile on upgrade by @jdx in [#9442](#9442) - **(ls-remote)** omit rolling/prerelease from JSON when false by @jdx in [#9439](#9439) - **(task)** support usage refs in dependency template tags by @jdx in [#9424](#9424) - **(task)** populate usage.cmd for subcommand-only tasks; share make_usage_ctx by @jdx in [#9431](#9431) - **(task)** resolve sandbox allow_read/allow_write against task dir by @jdx in [#9428](#9428) ### 📚 Documentation - **(site)** add self-hosted page tracker via Cloudflare Worker, drop GoatCounter by @jdx in [#9430](#9430) ### New Contributors - @vhespanha made their first contribution in [#9427](#9427) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Summary
--name-onlytomise tasks ls(andmise tasks) that prints one task name per line with no padding, header, or description column — drop-in for piping tofzfand similar tools withoutsed/awkcleanup.--json,--extended,--usage(clap rejects the combos). Composes with--all,--global/--local,--hidden,--sort/--sort-order,--no-header. The internal hidden--completeflag isn't in the conflicts list — making--name-onlyglobal while referencing the non-global--completepanics clap on sibling subcommands (tasks info,tasks add, …) that don't carry--complete. Practically a non-issue:--completeis a hidden flag used by shell completions, and therun()dispatch checks it before--name-only, so a stray combo just routes to--completeoutput.Before, the discussion's workaround was:
mise run `mise tasks ls --all --no-header | sed -E 's#^(//[a-z:]*).*#\1#' | fzf`After:
mise run `mise tasks ls --name-only --all | fzf`The new printer uses
calm_io::stdoutln!(matching the existing--completeoutput path) so a broken pipe — common when fzf accepts a selection before all output is consumed — is swallowed cleanly.Test plan
mise run buildmise run lintmise run test:e2e test_task_ls_name_only test_task_ls test_task_ls_global test_task_ls_json_resolved_dircargo test --bin mise cli::tests::test_subcommands_are_sorted(alphabetical flag ordering)mise tasks ls --name-only,mise tasks --name-only,mise tasks ls --name-only | fzfwork; defaultmise tasks lstable is unchangedmise tasks ls --name-only --json,--name-only -x,--name-only --usageare rejected by clap🤖 Generated with Claude Code
Note
Low Risk
Low risk: introduces an additional CLI output mode with explicit flag conflicts and includes an e2e test, without changing task resolution or execution paths.
Overview
Adds a new
--name-onlyflag tomise tasks ls(and the top-levelmise taskswrapper) that prints just task names, one per line, for easy piping to tools likefzf.The flag is enforced to conflict with other output formats (
--json,--extended,--usage) and is covered by a new e2e test; autogenerated docs, manpage, usage spec (mise.usage.kdl), and Fig completion metadata are updated accordingly.Reviewed by Cursor Bugbot for commit 146f3f5. Bugbot is set up for automated code reviews on this repo. Configure here.