Skip to content

Fix cobra command and rename more things from cagent to docker agent#1979

Open
dgageot wants to merge 1 commit intodocker:mainfrom
dgageot:fix-cobra-command
Open

Fix cobra command and rename more things from cagent to docker agent#1979
dgageot wants to merge 1 commit intodocker:mainfrom
dgageot:fix-cobra-command

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 7, 2026

  • Fix completion
  • Remove special case for cagent and cagent.exe
  • Fix error message when a gateway is set but Docker Desktop is not started
  • Fix the categories of the sub commands in the usage message
  • Fix the cobra Examples
  • Simplify the code especially for the handling of the default "run" command

Signed-off-by: David Gageot <david.gageot@docker.com>
@dgageot dgageot requested a review from a team as a code owner March 7, 2026 10:22
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

Assessment: 🟢 APPROVE

This PR successfully renames 'cagent' to 'docker-agent' throughout the codebase and fixes Cobra command configuration. The changes are primarily cosmetic (renaming) with one notable behavior change: the root command now defaults to running the 'run' subcommand when invoked without arguments, instead of showing help.

Key Changes:

  • Removed deprecated binary name (cagent) from build configuration
  • Updated all CLI examples and documentation strings
  • Consolidated telemetry initialization into PersistentPreRunE
  • Changed root command default behavior to execute run subcommand
  • Simplified Cobra command structure by removing runtime binary name detection

Verification:
All changes reviewed. No bugs detected in the modified code. The code handles edge cases appropriately (e.g., the 'run' command is guaranteed to exist when Find() is called).


No issues found in the changed code.

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.

1 participant