Spent some time messing around with completions, curious to get your thoughts.
Note: I don't feel this is actually ready for merging yet, just looking to get some eyes on it
The basic approach is to add a file alongside Bakefile that will store the completion functions. When completion is called it will source that file then check if a function exists matching the naming convention
_bake_completion_TASK_NAME
If so, that function will be used to provide completions (via white-space delimited stdout)
As I'm writing this, I'm realizing I could just move all completion responsibility to that function and have it simply provide completions via COMPREPLY
If no function is found then we fallback on default completion.
Key drawbacks that I see:
Completions are sourced into the user's shell, meaning they will persist in their shell
No easy way to link completion function to bake task (they must just match by name)
Not very configurable
Actual completion file (default: Bakefile.completions) feels arbitrary as the completion functions must just exist in the shell.
There is a potential issue where two projects have a bake task with the name name. If they are both used from the same shell, a completion for one could be used for both.
Spent some time messing around with completions, curious to get your thoughts. Note: I don't feel this is actually ready for merging yet, just looking to get some eyes on it
The basic approach is to add a file alongside Bakefile that will store the completion functions. When completion is called it will source that file then check if a function exists matching the naming convention
If so, that function will be used to provide completions (via white-space delimited stdout)
As I'm writing this, I'm realizing I could just move all completion responsibility to that function and have it simply provide completions via
COMPREPLY
If no function is found then we fallback on default completion.
Key drawbacks that I see:
Bakefile.completions
) feels arbitrary as the completion functions must just exist in the shell.