Skip to content

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

Merged
thaJeztah merged 15 commits into
docker:27.xfrom
thaJeztah:27.x_backport_container_completions
Nov 14, 2024
Merged

[27.x backport] Improve Cobra completions for run and create#5618
thaJeztah merged 15 commits into
docker:27.xfrom
thaJeztah:27.x_backport_container_completions

Conversation

@thaJeztah

Copy link
Copy Markdown
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 <github@albersweb.de>
(cherry picked from commit 761d767)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit b598ec8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit c555327)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit e513454)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit ac7bde6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 2d89339)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 5d709a8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 3292afe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 5f7c43e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 9a9ae23)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 3a2503f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 2915749)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit db0ed1e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 4525fe3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Credits to thaJeztah
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 06260e6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztahforce-pushed the 27.x_backport_container_completions branch from a667270 to 955e003CompareNovember 14, 2024 16:05
@codecov-commenter

codecov-commenter commented Nov 14, 2024

Copy link
Copy Markdown

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.xNov 14, 2024
@thaJeztah
thaJeztah deleted the 27.x_backport_container_completions branch November 14, 2024 17:25
Sign up for freeto 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

@thaJeztah@codecov-commenter@robmry@albers