Skip to content

Fix bash/zsh/... completion#1794

Merged
krissetto merged 1 commit intodocker:mainfrom
dgageot:fix-completion
Feb 19, 2026
Merged

Fix bash/zsh/... completion#1794
krissetto merged 1 commit intodocker:mainfrom
dgageot:fix-completion

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Feb 19, 2026

Add __complete and __completeNoDesc to isSubcommand() so they are passed through directly, reducing completion time from ~1.2s to ~30ms.

Assisted-By: cagent

defaultToRun() was not recognizing __complete and __completeNoDesc as
subcommands, causing it to prepend 'run' to completion args. This made
the run command try to resolve '__complete' as an OCI agent reference,
resulting in a ~1.2s network call to Docker Hub on every tab completion.

Add __complete and __completeNoDesc to isSubcommand() so they are
passed through directly, reducing completion time from ~1.2s to ~30ms.

Assisted-By: cagent
@dgageot dgageot requested a review from a team as a code owner February 19, 2026 12:24
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Approved - No issues found

The changes look good! This PR makes a straightforward enhancement to the completion handling:

  • Code change: Refactored isSubcommand() to use a switch statement and added __complete and __completeNoDesc as recognized special commands
  • Testing: Added appropriate test cases to verify the new completion commands are passed through correctly
  • Impact: As described, this should significantly improve completion time from ~1.2s to ~30ms by ensuring completion commands bypass the default "run" prepending logic

The implementation is clean, well-tested, and matches the intended behavior.

@krissetto krissetto merged commit bd14cb0 into docker:main Feb 19, 2026
8 checks passed
@dgageot dgageot deleted the fix-completion branch February 27, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants