Skip to content

feat(cli): support alias list --json output#2966

Merged
Sayt-0 merged 2 commits into
mainfrom
feat/alias-list-json
Jun 2, 2026
Merged

feat(cli): support alias list --json output#2966
Sayt-0 merged 2 commits into
mainfrom
feat/alias-list-json

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Jun 2, 2026

Copy link
Copy Markdown
Member

Closes #2965

@Sayt-0 Sayt-0 requested a review from a team as a code owner June 2, 2026 09:39

@docker-agent docker-agent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

The implementation is clean and correct. The --json flag for alias list is well-structured:

  • Uses a proper closure to capture asJSON flag value
  • Sorts aliases alphabetically (consistent with the non-JSON path)
  • Handles empty alias lists correctly (outputs [] — valid for JSON consumers)
  • Maps all alias fields to a typed aliasListEntry struct with appropriate omitempty tags
  • Error handling is consistent with the rest of the file

No bugs found in the added code.

Comment thread cmd/root/alias.go
Comment thread cmd/root/alias.go Outdated
entries := make([]aliasListEntry, 0, len(names))
for _, name := range names {
alias := allAliases[name]
entries = append(entries, aliasListEntry{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

probably don't need this either

Comment thread cmd/root/alias.go
@Sayt-0 Sayt-0 force-pushed the feat/alias-list-json branch from 0577fb2 to 3aef9c2 Compare June 2, 2026 12:04
@Sayt-0 Sayt-0 force-pushed the feat/alias-list-json branch 2 times, most recently from 0784d11 to 44f4c4e Compare June 2, 2026 13:12
Sayt-0 and others added 2 commits June 2, 2026 15:29
Add a --json flag to `docker agent alias list` that emits the registered
aliases as a sorted JSON array, with empty options omitted.

Closes #2965
Signed-off-by: Sayt-0 <louis-dalmorocompta@docker.com>
@Sayt-0 Sayt-0 force-pushed the feat/alias-list-json branch from 44f4c4e to fe03d98 Compare June 2, 2026 13:29
@Sayt-0 Sayt-0 merged commit 7872274 into main Jun 2, 2026
9 checks passed
@Sayt-0 Sayt-0 deleted the feat/alias-list-json branch June 2, 2026 13:56
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.

Support docker agent alias list --json

3 participants