Skip to content

feat(task): add --name-only flag to mise tasks ls#9435

Merged
jdx merged 6 commits intomainfrom
claude/serene-mestorf-07aa8b
Apr 27, 2026
Merged

feat(task): add --name-only flag to mise tasks ls#9435
jdx merged 6 commits intomainfrom
claude/serene-mestorf-07aa8b

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 27, 2026

Summary

  • Adds --name-only to mise tasks ls (and mise tasks) that prints one task name per line with no padding, header, or description column — drop-in for piping to fzf and similar tools without sed/awk cleanup.
  • Conflicts with --json, --extended, --usage (clap rejects the combos). Composes with --all, --global/--local, --hidden, --sort/--sort-order, --no-header. The internal hidden --complete flag isn't in the conflicts list — making --name-only global while referencing the non-global --complete panics clap on sibling subcommands (tasks info, tasks add, …) that don't carry --complete. Practically a non-issue: --complete is a hidden flag used by shell completions, and the run() dispatch checks it before --name-only, so a stray combo just routes to --complete output.
  • Closes discussion #9434.

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 --complete output path) so a broken pipe — common when fzf accepts a selection before all output is consumed — is swallowed cleanly.

Test plan

  • mise run build
  • mise run lint
  • mise run test:e2e test_task_ls_name_only test_task_ls test_task_ls_global test_task_ls_json_resolved_dir
  • cargo test --bin mise cli::tests::test_subcommands_are_sorted (alphabetical flag ordering)
  • Manual: mise tasks ls --name-only, mise tasks --name-only, mise tasks ls --name-only | fzf work; default mise tasks ls table is unchanged
  • Manual: mise tasks ls --name-only --json, --name-only -x, --name-only --usage are 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-only flag to mise tasks ls (and the top-level mise tasks wrapper) that prints just task names, one per line, for easy piping to tools like fzf.

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.

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]>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/cli/tasks/ls.rs
Comment on lines +71 to +75
#[clap(
long,
verbatim_doc_comment,
conflicts_with_all = ["json", "extended", "complete", "usage"]
)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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).

Suggested change
#[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"]
)]

Comment thread mise.usage.kdl Outdated
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."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add global=#true to the --name-only flag to match the behavior of other global flags in the tasks command and ensure consistency with the implementation in src/cli/tasks/ls.rs.

    flag --name-only help="Only show task names, one per line. Useful for piping to fzf and similar tools." global=#true

Comment thread mise.usage.kdl Outdated
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."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add global=#true to the --name-only flag for the ls subcommand to maintain consistency with the parent command's flag definition.

        flag --name-only help="Only show task names, one per line. Useful for piping to fzf and similar tools." global=#true

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

Adds a --name-only flag to mise tasks ls (and mise tasks) that prints one task name per line with no padding, header, or description — making it easy to pipe directly to fzf and similar tools. The implementation is clean: it reuses the calm_io::stdoutln! pattern from the existing --complete path for correct broken-pipe handling, conflicts with --json/--extended/--usage are enforced via clap, and the flag composes properly with --all, --sort, --sort-order, --hidden, and --global/--local. Documentation, man page, Fig completions, and usage spec are all kept in sync.

Confidence Score: 5/5

Safe 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 --complete omission is documented, broken-pipe is handled via calm_io, and the e2e test covers output correctness, composability, and conflict rejection. No P1 or P0 issues found.

No files require special attention.

Important Files Changed

Filename Overview
src/cli/tasks/ls.rs Core implementation: adds name_only field with correct conflicts, dispatches before display() but after complete, uses calm_io::stdoutln! for clean broken-pipe behavior. Intentional omission of complete from conflicts_with_all is documented in the PR description.
e2e/tasks/test_task_ls_name_only New e2e test covering basic output, --no-header composability, --sort/--sort-order, --global/--local filtering, and conflict cases for --json, -x, and --usage.
docs/cli/tasks/ls.md Adds --name-only docs entry in correct alphabetical position between --hidden and --no-header.
docs/cli/tasks.md Parallel update to parent tasks command docs, consistent with tasks/ls.md.
mise.usage.kdl Adds --name-only as a global flag in both tasks and tasks ls spec blocks; correctly marked global=#true.
xtasks/fig/src/mise.ts Fig completion spec updated for both tasks and tasks ls subcommands with --name-only.
man/man1/mise.1 Man page updated with --name-only for both tasks and tasks ls sections.

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]
Loading

Reviews (6): Last reviewed commit: "Merge branch 'main' into claude/serene-m..." | Re-trigger Greptile

Comment thread e2e/tasks/test_task_ls_name_only
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]>
Comment thread src/cli/tasks/ls.rs
jdx and others added 2 commits April 27, 2026 12:56
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]>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Hyperfine Performance

mise x -- echo

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%

@jdx jdx enabled auto-merge (squash) April 27, 2026 18:47
@jdx jdx merged commit 6ff289a into main Apr 27, 2026
37 checks passed
@jdx jdx deleted the claude/serene-mestorf-07aa8b branch April 27, 2026 21:40
mise-en-dev added a commit that referenced this pull request Apr 28, 2026
### 🚀 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>
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

Successfully merging this pull request may close these issues.

1 participant