-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
tailscale-app: Generate completions for the installed CLI. #223049
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
Conversation
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.
I'm on cellular internet right now and I don't have a local checkout, so these are impractical to run. However, |
9a81fc9
to
45f92ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
Casks/t/tailscale-app.rb
Outdated
@@ -28,6 +28,10 @@ | |||
EOS | |||
end | |||
|
|||
def install |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
Okay, I'm at a bit of a loss. It seems that no casks use They all use:
That only leaves out 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. |
Apart from the formula issues, I think you will find that the completion command will fail after a fresh install.
Even for help you need to be logged in
So (I'm not a maintainer nor an expert in brew) but I think this will be an issue. |
Ah, that's really unfortunate if that's the case. However, I just purged my entire Tailscale install (using AppCleaner and |
I think it was because I had another VPN running. Once I stopped that one, I was able issue CLI command. |
install do | ||
generate_completions_from_executable("#{appdir}/Tailscale.app/Contents/MacOS/Tailscale", "completion") | ||
end |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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? |
…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.
No, there isn't. This is the first time we've encountered this AFAIK. |
…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.
…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.
The
tailscale-app
cask wraps/Applications/Tailscale.app/Contents/MacOS/Tailscale
and places it into the path astailscale
.This command can generate its own completions. Support for this was added to the headless
tailscale
formula at Homebrew/homebrew-core#172679This 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:
brew audit --cask --online <cask>
is error-free.brew style --fix <cask>
reports no offenses.