Skip to content

Improve bash completion with alias extraction and submodule support#2968

Closed
tomers wants to merge 4 commits intocasey:masterfrom
tomers:improve-bash-completion
Closed

Improve bash completion with alias extraction and submodule support#2968
tomers wants to merge 4 commits intocasey:masterfrom
tomers:improve-bash-completion

Conversation

@tomers
Copy link
Copy Markdown

@tomers tomers commented Nov 22, 2025

Enhanced the bash completion script with the following improvements:

  • Extract both recipes and aliases from 'just --list' output instead of only using 'just --summary', providing more complete completions
  • Add support for submodule recipe completion when typing 'just '
  • Automatically detect module justfiles in common locations (, /justfile, modules/, modules//justfile)
  • Parse aliases from both [alias: ...] and [aliases: ...] patterns in list output
  • Add fallback to --summary if --list fails for better compatibility
  • Improve recipe name extraction to handle edge cases better

These changes make tab completion more comprehensive and useful for projects using just modules and aliases.

Enhanced the bash completion script with the following improvements:

- Extract both recipes and aliases from 'just --list' output instead of
  only using 'just --summary', providing more complete completions
- Add support for submodule recipe completion when typing 'just <module> <recipe>'
- Automatically detect module justfiles in common locations
  (, /justfile, modules/, modules//justfile)
- Parse aliases from both [alias: ...] and [aliases: ...] patterns in list output
- Add fallback to --summary if --list fails for better compatibility
- Improve recipe name extraction to handle edge cases better

These changes make tab completion more comprehensive and useful for projects
using just modules and aliases.
Update ~/.just.bash completion function to derive subcommands from just --summary
Make recipe completion hierarchical, completing one :: segment at a time
Support arbitrary nesting depth so patterns like j tests api test complete step-by-step instead of tests api::test
@tomers tomers force-pushed the improve-bash-completion branch from e92f9c5 to cdb12ab Compare December 2, 2025 11:38
Refactor the completion function to locate and utilize justfiles in project directories, allowing for more accurate recipe and alias completions. This update improves the hierarchical completion by searching for justfiles based on the current working directory and the provided prefix, while maintaining a fallback to the previous summary method for broader compatibility.
@Spatenheinz
Copy link
Copy Markdown
Contributor

I tried this change out. Really some nice completion going on

@tomers
Copy link
Copy Markdown
Author

tomers commented Jan 29, 2026

@casey can you please have a look?

@casey
Copy link
Copy Markdown
Owner

casey commented Mar 22, 2026

Thanks for the PR!

I switched to using Clap's dynamic completion engine in #3167. The new completion engine calls into the just binary to get completions. This allows us to implement custom completion logic in Rust for all supported shells, instead of having to patch in support for each individual shell.

I created #2406 to track improvements to the new completion engine in one place.

The new completion engine is a complete overhaul, new features need to be added in Rust, which makes them work across shells, so this no longer applies. Please comment in #2406 if any of the improvements here still make sense with the new engine.

@casey casey closed this Mar 22, 2026
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.

3 participants