Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

kadinsayani
Copy link
Contributor

@kadinsayani kadinsayani commented Nov 21, 2024

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 Snap override-build step and stream editing the file to work with snapd completions, including a modified script is more reliable. Moving forward, completions for the LXC CLI can be added/changed directly in lxc/completion.go with a guarantee that Cobra completion directives (such as ShellCompDirectiveNoSpace and ShellCompDirectiveNoFileComp) will get along with snapd.

For reference, here is the associated PR for lxd-pkg-snap.

scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
scripts/bash/snap_completer.sh Fixed Show fixed Hide fixed
This commit adds `snap_completer.sh`, which provides improved bash
completions for the LXD snap.

Signed-off-by: Kadin Sayani <kadin.sayani@canonical.com>
@kadinsayani kadinsayani linked an issue Nov 21, 2024 that may be closed by this pull request
Copy link
Member

@simondeziel simondeziel left a 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.

@kadinsayani
Copy link
Contributor Author

kadinsayani commented Nov 22, 2024

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.

@kadinsayani
Copy link
Contributor Author

I've put up canonical/lxd-pkg-snap#630 to that effect, still untested though.

Thanks for putting this up :)

@kadinsayani
Copy link
Contributor Author

Closing in favour of canonical/lxd-pkg-snap#630. Thanks @simondeziel 😄

@kadinsayani kadinsayani deleted the completer-script branch November 22, 2024 14:52
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.

lxc storage volume copy completion issue
2 participants