Skip to content

Add targets command#287

Open
duanemay wants to merge 1 commit intomasterfrom
target
Open

Add targets command#287
duanemay wants to merge 1 commit intomasterfrom
target

Conversation

@duanemay
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 24, 2026 19:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new uaa targets command to list all configured UAA targets (marking the active one), along with documentation and integration-style tests.

Changes:

  • Introduces targets Cobra command that prints all saved targets and marks the active target with *.
  • Adds Ginkgo/Gomega coverage for no-target, single-target, and multi-target scenarios.
  • Adds user-facing documentation for the new command output and usage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
docs/commands/targets.md New documentation page for uaa targets, including expected output format.
cmd/targets.go Implements the targets command and output formatting.
cmd/targets_test.go Adds test coverage for targets command behavior across config states.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/targets_test.go
Comment on lines +73 to +76
output := string(session.Out.Contents())
Expect(output).To(ContainSubstring("* "))
Expect(output).To(ContainSubstring(secondURL))
})
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This only checks that the output contains "* ", but it doesn’t verify that only one target is marked active (the test would still pass if multiple lines had *). Consider asserting the count of active markers is exactly 1, and that it appears on the active target’s line.

Copilot uses AI. Check for mistakes.
Comment thread cmd/targets.go
if k == cfg.ActiveTargetName {
marker = "* "
}
log.Info(fmt.Sprintf("%s%d: %s", marker, i+1, target.BaseUrl))
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

Minor: cli.Logger already provides Infof, so you can avoid the extra fmt.Sprintf allocation/import here by using log.Infof(...) directly.

Copilot uses AI. Check for mistakes.
Comment thread docs/commands/targets.md
Comment on lines +1 to +5
# targets

[← Command Reference](../commands.md)

List all registered targets. The active target is marked with `*`.
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

targets.md is added, but the command isn’t discoverable from the command index (docs/commands.md) yet. Add a targets row under "Getting Started" (near target) so the new documentation page is reachable from the reference list.

Copilot uses AI. Check for mistakes.
Comment thread cmd/targets_test.go
Comment on lines +61 to +67
It("exits 0 and lists all targets with active marker on the second", func() {
session := runCommand("targets")

Eventually(session).Should(Exit(0))
Expect(session.Out).To(Say(server.URL()))
Expect(session.Out).To(Say(secondURL))
})
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This test description says the active marker is on the second target, but the assertions only check that both URLs appear. Please also assert that the * marker (and index) are printed on the active target’s line (e.g., matching the full line containing * + index + second URL).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants