Skip to content

Completions for go-task #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamescrosswell opened this issue May 18, 2025 · 2 comments · Fixed by #20
Closed

Completions for go-task #19

jamescrosswell opened this issue May 18, 2025 · 2 comments · Fixed by #20

Comments

@jamescrosswell
Copy link
Contributor

In module 3 (setting up a kind cluster) there's a bit of a detour on how to set up completions for go-task.

The taskfile.dev website suggests installing completions by running: eval "$(task --completion <shell>)". However initially when I tried that in the devbox shell I got the error: unknown flag: --completion.

I took a look at task --help and, indeed, there's no such flag.

After running devbox update go-task to update to the latest version of task (currently 3.43.2) everything worked fine... and I found I could set this up automatically by tweaking the devbox.json file like so:

  "shell": {
    "init_hook": [
      "export GOBIN=$(git rev-parse --show-toplevel)/bin",
      "export PATH=$GOBIN:$PATH",
-      "go install sigs.k8s.io/[email protected]"
+      "go install sigs.k8s.io/[email protected]",
+      "eval \"$(task --completion zsh)\""
    ],
    "scripts": {
      "test": ["echo \"Error: no test specified\" && exit 1"]
    }
  }

Since I'm new to devbox and go-task, a little bit of head scratching was required to get to that point. Possibly worth making a commit to bump to the latest version of go-task (assuming this wouldn't break anything else in the tutorial) to make it easier for other folks when they're getting started here?

@damitti444
Copy link

damitti444 commented May 29, 2025

I was still getting the following output after devbox shell

Starting a devbox shell...
/dev/fd/13:18: command not found: compdef
(eval):2: command not found: compdef

Therefore also needed to add the following to my ~/.zshrc on my system as stated in the devbox documentation on completions to get working completions at all for devbox and go-task

autoload -U compinit; compinit

@sidpalas
Copy link
Owner

Possibly worth making a commit to bump to the latest version of go-task (assuming this wouldn't break anything else in the tutorial) to make it easier for other folks when they're getting started here?

Want to put up a PR with this?

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 a pull request may close this issue.

3 participants