-
Notifications
You must be signed in to change notification settings - Fork 929
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
Snapcraft: Improved LXD Snap Completions #14506
Conversation
d47639f
to
01b7da6
Compare
01b7da6
to
83ff572
Compare
This commit adds `snap_completer.sh`, which provides improved bash completions for the LXD snap. Signed-off-by: Kadin Sayani <[email protected]>
83ff572
to
99a0230
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.
As annoying/agonizing as it is, I think we could still get away with keeping the snapcraft
build time inline patching if we add the following (albeit ugly) bit:
lxc completion bash | sed ... -e 's|$(type -t compopt)|"builtin"|' ...
I've put up canonical/lxd-pkg-snap#630 to that effect, still untested though.
I’ll give this a try tomorrow. If both approaches work, it’s just a matter of preference. I like using the modified script in this PR because it has comments about my findings throughout the debugging process with the hope that future issues will be easier to resolve. Also, it puts us in the driver seat rather than relying on Cobra's generated completion script. |
Thanks for putting this up :) |
Closing in favour of canonical/lxd-pkg-snap#630. Thanks @simondeziel 😄 |
Fixes the extraneous space issue raised in #14264.
This PR adds
snap_completer.sh
, which provides improved bash completions for the LXD snap. Rather than generating the completion script during the LXD Snapoverride-build
step and stream editing the file to work withsnapd
completions, including a modified script is more reliable. Moving forward, completions for the LXC CLI can be added/changed directly inlxc/completion.go
with a guarantee that Cobra completion directives (such asShellCompDirectiveNoSpace
andShellCompDirectiveNoFileComp
) will get along withsnapd
.For reference, here is the associated PR for
lxd-pkg-snap
.