task
task copied to clipboard
feat: completions command
Fixes #293
A draft PR based off this comment.
It's a pretty simple implementation. We have a new internal package called completion
. This will embed any files in the internal/completion/templates/*
directory and when the --completion <shell>
flag is given, it will read the template with the corresponding template name, insert any template values and return the string which will then be output to stdout.
I've added a task.tpl.example
file to illustrate how you would add a completions script. I'm not super proficient with completion scripts (I have a bit of experience with ZSH), so maybe if we're happy with this approach, we can merge with no templates and slowly migrate the old scripts to this new concept.
I wasn't sure what the best format for the template filenames was. I think we want them to end with .zsh
/.bash
etc so we get syntax highlighting, but I also added the .tpl
prefix so that anyone using a go templating extension/plug could add .tpl.bash
etc to the list of templated files without also targeting normal .bash
files. Let me know if you think there's a better way?