-
Notifications
You must be signed in to change notification settings - Fork 407
feat(docs): add autocompletion docs #2010
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
base: main
Are you sure you want to change the base?
Conversation
53d273e to
70659d2
Compare
|
Huh neat, I had no idea this was a thing. |
henderkes
left a comment
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.
should we add this to the rpm/deb packages?
|
Hmm, bash autocompletion isn't working for me. Neither on RHEL 10 nor on Trixie. I checked with |
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.
Completion is broken because it installs it for caddy, not for frankenphp.
We could fix it with source <(frankenphp completion bash | sed 's/caddy/frankenphp/g') if there's no better way to replace it in code.
|
That's strange, I'm not sure how I made it work then 🤔 This is curious, I need to investigate this.
And thanks for the PR on my fork, I'll have a deeper look tomorrow! |
|
Perhaps there's something like the CustomVersion parameter that we need to set to update the binary name? @mholt would likely know, I've googled without much luck. |
|
@henderkes Letsee... I didn't implement that, I think we're using Cobra for completion generation. I dunno if that gives you enough of a hint, I'll keep looking for a few minutes before I have to move onto something else. But I think @mohammed90 might have an idea. |
|
Oh, did you run the completion command with |
It's running with |
|
@henderkes I might have found it: https://github.com/caddyserver/caddy/blob/67a9e0657e60df8c78510065e8977d86ee17d01c/cmd/cobra.go#L13 If you change that line, does it have the expected results for you? |
|
I'll figure out how to make xcaddy build with a local caddy source tree and report back... hopefully tomorrow. If not, it will have to wait until next week after SymfonyCon. Thank you for your input! |
|
I am a bit busy atm or I'd just check for you. If changing that variable does work (again, I don't know the internals of Cobra, so it's a guess, but probably a good one), we can find a way to export that or somehow accommodate your build process. |
|
Matt is right, Cobra takes the name of the root command, which in our case is Caddy. https://github.com/spf13/cobra/blob/fc81d2003469e2a5c440306d04a6d82a54065979/completions.go#L824 I'm not sure how we could modularize it, from the top of my head. |
|
We could probably export it to a package-level variable, that can be changed at init-time... or some sort of const that gets changed during a build step, I dunno. |
|
Perhaps similar to how we can overwrite the version output? |
No description provided.