Skip to content

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented May 6, 2025

inspect: disable default (file) completion

Before this patch, flags and arguments would complete using filenames
from the current directory;

docker inspect --type <TAB>
AUTHORS       CONTRIBUTING.md             docs/             Makefile            SECURITY.md
...

docker inspect <TAB>

With this patch, no completion is provided;

docker inspect --type <TAB>
# no results

docker inspect <TAB>
# no results

inspect: add shell-completion for "--type" flag

With this patch:

docker inspect --type <TAB>
config     image    node    secret   task
container  network  plugin  service  volume

inspect: update flag description of "--type" flag

Before this patch:

docker inspect --help | grep '\-\-type'
      --type string     Return JSON for specified type

With this patch:

docker inspect --help | grep '\-\-type'
      --type string     Only inspect objects of the given type

inspect: improve (flag) validation

Produce an error if the --type flag was set, but an empty value
was passed.

Before this patch:

docker inspect --type "" foo
# json output

docker inspect --type unknown foo
"unknown" is not a valid value for --type

With this patch:

docker inspect --type "" foo
type is empty: must be one of "config", "container", "image", "network", "node", "plugin", "secret", "service", "task", "volume"

docker inspect --type unknown foo
unknown type: "unknown": must be one of "config", "container", "image", "network", "node", "plugin", "secret", "service", "task", "volume"

- Human readable description for the release notes

`docker inspect`: add shell completion, improve flag-description for `--type` and improve validation

- A picture of a cute animal (not mandatory but encouraged)

thaJeztah added 5 commits May 6, 2025 15:43
Before this patch, flags and arguments would complete using filenames
from the current directory;

    docker inspect --type <TAB>
    AUTHORS       CONTRIBUTING.md             docs/             Makefile            SECURITY.md
    ...

    docker inspect <TAB>

With this patch, no completion is provided;

    docker inspect --type <TAB>
    # no results

    docker inspect <TAB>
    # no results

Signed-off-by: Sebastiaan van Stijn <[email protected]>
With this patch:

    docker inspect --type <TAB>
    config     image    node    secret   task
    container  network  plugin  service  volume

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Before this patch:

    docker inspect --help | grep '\-\-type'
          --type string     Return JSON for specified type

With this patch:

    docker inspect --help | grep '\-\-type'
          --type string     Only inspect objects of the given type

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Produce an error if the `--type` flag was set, but an empty value
was passed.

Before this patch:

    docker inspect --type "" foo
    # json output

    docker inspect --type unknown foo
    "unknown" is not a valid value for --type

With this patch:

    docker inspect --type "" foo
    type is empty: must be one of "config", "container", "image", "network", "node", "plugin", "secret", "service", "task", "volume"

    docker inspect --type unknown foo
    unknown type: "unknown": must be one of "config", "container", "image", "network", "node", "plugin", "secret", "service", "task", "volume"

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented May 6, 2025

Codecov Report

Attention: Patch coverage is 48.14815% with 14 lines in your changes missing coverage. Please review.

Project coverage is 59.07%. Comparing base (25a1681) to head (52752f3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6052      +/-   ##
==========================================
+ Coverage   58.99%   59.07%   +0.08%     
==========================================
  Files         358      358              
  Lines       30004    30013       +9     
==========================================
+ Hits        17700    17731      +31     
+ Misses      11323    11301      -22     
  Partials      981      981              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thaJeztah thaJeztah merged commit a2a1376 into docker:master May 6, 2025
105 checks passed
@thaJeztah thaJeztah deleted the inspect_completion branch May 6, 2025 18:29
@thaJeztah thaJeztah modified the milestones: 28.1.2, 28.2.0 May 15, 2025
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.

3 participants