Improve shell completion for `docker secret` and `docker config` subcommands by thaJeztah · Pull Request #6446 · docker/cli · GitHub
Skip to content

Improve shell completion for docker secret and docker config subcommands - #6446

Merged
thaJeztah merged 4 commits into
docker:masterfrom
thaJeztah:fix_completions
Sep 10, 2025
Merged

thaJeztah merged 4 commits into
docker:masterfrom
thaJeztah:fix_completions

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

remove redundant closures around completion functions

These were remnants from some earlier implementation.

cli/command/secret: remove completion for "ls"

This command takes no arguments, so should not provide completion.

cli/command/secret: fix completion to complete names, not IDs

cli/command: fix completion for secret create, config create

These commands accept two arguments; the first is a custom name,
the second is either a filename or "-" to create from STDIN.

With this patch:

# does not provide completion
docker secret create <tab>

# starts providing completion once a non-empty name is provided
docker secret create somename<tab>
file.txt other-file.txt

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

Improve shell completion for `docker secret` and `docker config` subcommands.

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

These were remnants from some earlier implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This command takes no arguments, so should not provide completion.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
These commands accept two arguments; the first is a custom name,
the second is either a filename or "-" to create from STDIN.

With this patch:

    # does not provide completion
    docker secret create <tab>

    # starts providing completion once a non-empty name is provided
    docker secret create somename<tab>
    file.txt other-file.txt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter

Copy link
Copy Markdown

@thaJeztah

thaJeztah commented Sep 10, 2025 •

Copy link
Copy Markdown
Member Author

Interesting failure;

--- FAIL: TestGetAutoPAT (0.00s)
    --- FAIL: TestGetAutoPAT/general_error (0.00s)
        api_test.go:388: assertion failed: expected error to contain "unexpected response from Hub: 500 Internal Server Error", got "Post \"http://127.0.0.1:49229/v2/access-tokens/desktop-generate/\"": net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called"

@thaJeztah

Copy link
Copy Markdown
Member Author

@thaJeztah
thaJeztah merged commit 2f6abcf into docker:master Sep 10, 2025
104 of 105 checks passed
@thaJeztah
thaJeztah deleted the fix_completions branch September 10, 2025 12:30
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