Skip to content

Conversation

lgarron
Copy link
Contributor

@lgarron lgarron commented Aug 7, 2025

The tailscale-app cask wraps /Applications/Tailscale.app/Contents/MacOS/Tailscale and places it into the path as tailscale.

This command can generate its own completions. Support for this was added to the headless tailscale formula at Homebrew/homebrew-core#172679

This PR adds the same support to the tailscale-app cask, using the same mechanism.


Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.

In the following questions <cask> is the token of the cask you're submitting.

After making any changes to a cask, existing or new, verify:

The `tailscale-app` cask wraps `/Applications/Tailscale.app/Contents/MacOS/Tailscale` and places it into the path as `tailscale`.

This command can generate its own completions. Support for this was added to the headless `tailscale` *formula* at Homebrew/homebrew-core#172679

This PR adds the same support to the `tailscale-app` cask, using the same mechanism.
@lgarron
Copy link
Contributor Author

lgarron commented Aug 7, 2025

  • brew audit --cask --online <cask> is error-free.
  • brew style --fix <cask> reports no offenses.

I'm on cellular internet right now and I don't have a local checkout, so these are impractical to run.

However, brew reinstall tailscale-app on the modified cask successfully installed the completions.

@lgarron lgarron force-pushed the patch-3 branch 2 times, most recently from 9a81fc9 to 45f92ba Compare August 7, 2025 07:49
Copy link
Contributor Author

@lgarron lgarron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@@ -28,6 +28,10 @@
EOS
end

def install
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter wants me to rewrite this to:

define_method(:install)

However, this also causes CI to fail: https://github.com/Homebrew/homebrew-cask/actions/runs/16798346181/job/47573677907

I'm not sure what I'm supposed to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like install is not allowed by the linter, even though it is run by brew install --cask? I'm going to try postflight.

@lgarron
Copy link
Contributor Author

lgarron commented Aug 7, 2025

Okay, I'm at a bit of a loss. It seems that no casks use generate_completions_from_executable(…).

They all use:

  • bash_completion
  • fish_completion
  • zsh_completion

That only leaves out powershell from the completions supported by the tailscale CLI, which I guess is fine given that this cask is for the macOS app?

However, these assume that there is a completion file rather than a completion command whose output provides the completions. I'm not sure what to do.

@oschrenk
Copy link
Contributor

oschrenk commented Aug 7, 2025

Apart from the formula issues, I think you will find that the completion command will fail after a fresh install.

❯ tailscale completion
Error: CLI credentials are not available BadResponse

Even for help you need to be logged in

❯ tailscale --help
Error: CLI credentials are not available BadResponse

So (I'm not a maintainer nor an expert in brew) but I think this will be an issue.

@lgarron
Copy link
Contributor Author

lgarron commented Aug 8, 2025

Apart from the formula issues, I think you will find that the completion command will fail after a fresh install.

Ah, that's really unfortunate if that's the case.

However, I just purged my entire Tailscale install (using AppCleaner and brew uninstall tailscale-app) and ran brew install tailscale-app from scratch. I can't reproduce that error, even though I'm logged out. 🤔

@oschrenk
Copy link
Contributor

oschrenk commented Aug 8, 2025

I think it was because I had another VPN running. Once I stopped that one, I was able issue CLI command.

Comment on lines +31 to +33
install do
generate_completions_from_executable("#{appdir}/Tailscale.app/Contents/MacOS/Tailscale", "completion")
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgarron Thanks for trying to get this work, but I don't believe it is possible to generate completions in this way for a Cask, only with a Formula. The completion stanzas available only install the completions from an already built file.

Copy link
Contributor Author

@lgarron lgarron Aug 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It would be a shame to lose completions just because I'm installing tailscale-app rather than the tailscale formula, though.

I'm assuming there's a good reason for the incompatibility, or at least some engineering blockers.

As a workaround, would it be safe to write the completions to temporary files and then load those?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it really just comes down to how Casks and Formula differ.
Formula are built on CI, and Casks are simply a way of installing software as provided upstream in an automatable way.

@p-linnane
Copy link
Member

Closing as this is not possible. Sorry.

@p-linnane p-linnane closed this Aug 14, 2025
@lgarron
Copy link
Contributor Author

lgarron commented Aug 14, 2025

Closing as this is not possible. Sorry.

Alright, thanks for the help. I don't suppose there is an existing issue to track adding this functionality?

lgarron added a commit to lgarron/dotfiles that referenced this pull request Aug 14, 2025
…pletions.

I'm using `tailscale-app` instead of the previous combination (the Mac App Store version + `tailscale` CLI), because the latter borked my Tailscale connection when the binary and the app got ouf of sync. The `tailscale` CLI linked by `tailscale-app` is inside the `.app`, so it should prevent that issue.

See Homebrew/homebrew-cask#223049 for why the workaround for completions is needed.
@p-linnane
Copy link
Member

No, there isn't. This is the first time we've encountered this AFAIK.

lgarron added a commit to lgarron/dotfiles that referenced this pull request Aug 15, 2025
…pletions.

I'm using `tailscale-app` instead of the previous combination (the Mac App Store version + `tailscale` CLI), because the latter borked my Tailscale connection when the binary and the app got ouf of sync. The `tailscale` CLI linked by `tailscale-app` is inside the `.app`, so it should prevent that issue.

See Homebrew/homebrew-cask#223049 for why the workaround for completions is needed.
lgarron added a commit to lgarron/dotfiles that referenced this pull request Aug 15, 2025
…pletions.

I'm using `tailscale-app` instead of the previous combination (the Mac App Store version + `tailscale` CLI), because the latter borked my Tailscale connection when the binary and the app got ouf of sync. The `tailscale` CLI linked by `tailscale-app` is inside the `.app`, so it should prevent that issue.

See Homebrew/homebrew-cask#223049 for why the workaround for completions is needed.
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.

4 participants