How to create task's arguments autocompletion?
- Dominant language
- Rust
- Stars
- 35.8k
- Forks
- 846
- Avg merge
- 27m
- Merged PRs (30d)
- 3
Description
I have found no answer to the question in title in documentation nor GitHub issues nor PRs.
Is it possible to do something like that at all and if yes, could you please point me to documentation, source code or anything which can explain how to archive task arguments completion?
Below is a long explanation with example of what I would like to be able to do.
Let's say I created a task in my `justfile` with name `task-a` which accepts one argument with values `x`, `y`, `z`.
At the moment even if I setup auto completions for `just` (i.e. with `source <(~/.cargo/bin/just --completions bash)` command in `~/.bashrc`) I wasn't able to type `just task-a ` press `` and get auto completion suggestions for `x`, `y`, `z`. Or when I type `just task-a w` where `w` if first letter of `x` value and then press I would like to get completion to the full value of `x`.
Another example of this could be when I have `task-b` which accepts one argument which is a list (or filtered list) of files in a specific project directory. Then typing `just task-b some-fi` and then I would get a completion to `just task-b some-file-name` where `some-file-name` is a name of the file existing somewhere and implementation of `task-b` define where to find that file. In this case I don't assume `just` be smart enough to understand implementation of `task-b` I just want to explain (i.e. provide a path or mask to files) which can be used as potential variants for auto completion.
And thank you for the nice task runner! I really enjoy using it and extend my set of tasks almost every day!
Contributor guide
Research direction
Start with the generated Bash completion from `just --completions bash` and the issue's examples for task arguments and file lists. Determine whether completion behavior can be specified from a justfile or requires changes to the completion entry point; done means a documented or implemented way to complete the requested argument values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100