cli/container: use github.com/moby/sys/capability for completions#5480
Merged
thaJeztah merged 1 commit intodocker:masterfrom Oct 1, 2024
Merged
cli/container: use github.com/moby/sys/capability for completions#5480thaJeztah merged 1 commit intodocker:masterfrom
thaJeztah merged 1 commit intodocker:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5480 +/- ##
==========================================
+ Coverage 60.05% 60.07% +0.02%
==========================================
Files 345 345
Lines 23440 23447 +7
==========================================
+ Hits 14076 14085 +9
+ Misses 8390 8388 -2
Partials 974 974 |
laurazard
approved these changes
Sep 27, 2024
laurazard
reviewed
Sep 27, 2024
fb9858c to
7f0b119
Compare
We used a hard-coded list of capabilities that we copied from containerd, but the new "capability" package allows use to have a maintained list of capabilities. There's likely still some improvements to be made; First of all, the capability package could provide a function to get the list of strings. On the completion-side, we need to consider what format is most convenient; currently we use the canonical name (uppercase and "CAP_" prefix), however, tab-completion is case-sensitive by default, so requires the user to type uppercase letters to filter the list of options. Bash completion provides a `completion-ignore-case on` option to make completion case-insensitive (https://askubuntu.com/a/87066), but it looks to be a global option; the current cobra.CompletionOptions also don't provide this as an option to be used in the generated completion-script. Fish completion has `smartcase` (by default?) which matches any case if all of the input is lowercase. Zsh does not have a dedicated option, but allows setting matching-rules (see https://superuser.com/a/1092328). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
7f0b119 to
462e082
Compare
Member
Author
|
@laurazard updated; I added a minimal unit-test. Perhaps wouldn't hurt to add tests for some of the other ones as well (but didn't want to stuff those in this PR). For the "case-insensitive" auto-complete, I also want to do some experimenting in follow-ups. Related to that, I opened a PR to normalize and de-duplicate values in the client before we send the request; |
laurazard
approved these changes
Oct 1, 2024
Member
|
Thanks! LGTM |
This was referenced Oct 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We used a hard-coded list of capabilities that we copied from containerd, but the new "capability" package allows use to have a maintained list of capabilities.
There's likely still some improvements to be made;
First of all, the capability package could provide a function to get the list of strings.
On the completion-side, we need to consider what format is most convenient; currently we use the canonical name (uppercase and "CAP_" prefix), however, tab-completion is case-sensitive by default, so requires the user to type uppercase letters to filter the list of options.
Bash completion provides a
completion-ignore-case onoption to make completion case-insensitive (https://askubuntu.com/a/87066), but it looks to be a global option; the current cobra.CompletionOptions also don't provide this as an option to be used in the generated completion-script.Fish completion has
smartcase(by default?) which matches any case if all of the input is lowercase.Zsh does not have a dedicated option, but allows setting matching-rules (see https://superuser.com/a/1092328).
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)