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

[27.x backport] Improve Cobra completions for run and create #5618

Merged
merged 15 commits into from
Nov 14, 2024

Conversation

thaJeztah
Copy link
Member

- What I did
Added Cobra completion for all options of docker run and docker create.

- How I did it
Provided FlagCompletionFuncs for all options except for

  • boolean flags (default completion works)
  • flags with file completions (default completion works)
  • flags that already had a completion function.

The reference for my work was the legacy bash completion.
Features that I did not recreate:

  • completion for --user
  • completion for the individual log driver options
  • completion of non-built-in drivers

- How to verify it

  1. In a dev container, issue make completion, then try completions of various docker run and docker create commands.
  2. In another terminal, exec into the container, install the legacy completion with . ./contrib/completion/bash/docker. then execute the same completions for reference.

- Description for the changelog
Improved completions for docker run and docker create.

Ported some completions from the bash completion to the new cobra based completion.

Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 761d767)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit b598ec8)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit c555327)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit e513454)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit ac7bde6)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 2d89339)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 5d709a8)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 3292afe)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 5f7c43e)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 9a9ae23)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 3a2503f)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 2915749)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit db0ed1e)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 4525fe3)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Credits to thaJeztah

Signed-off-by: Harald Albers <[email protected]>
(cherry picked from commit 06260e6)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the 27.x_backport_container_completions branch from a667270 to 955e003 Compare November 14, 2024 16:05
@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 43.50282% with 100 lines in your changes missing coverage. Please review.

Project coverage is 58.29%. Comparing base (8caf347) to head (955e003).
Report is 25 commits behind head on 27.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             27.x    #5618      +/-   ##
==========================================
- Coverage   58.41%   58.29%   -0.13%     
==========================================
  Files         337      337              
  Lines       28899    29057     +158     
==========================================
+ Hits        16881    16938      +57     
- Misses      11050    11145      +95     
- Partials      968      974       +6     

@thaJeztah thaJeztah marked this pull request as ready for review November 14, 2024 16:12
@thaJeztah thaJeztah merged commit 75876b4 into docker:27.x Nov 14, 2024
87 checks passed
@thaJeztah thaJeztah deleted the 27.x_backport_container_completions branch November 14, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants