Skip to content

Commit 464002b

Browse files
Exclude repository_url from upstream:list default fields
- Add @default-fields annotation to exclude repository_url from default display - This maintains backward compatibility for automation scripts - repository_url is still accessible via --fields=repository_url - Add tests to verify both default behavior and explicit field selection Updates DEVX-5163 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent b4ea33f commit 464002b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Commands/Upstream/ListCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ListCommand extends TerminusCommand
3333
* framework: Framework
3434
* repository_url: Repository URL
3535
* organization: Organization
36+
* @default-fields id,label,machine_name,category,type,framework,organization
3637
* @option all Show all upstreams
3738
* @option framework DEPRECATED Framework filter
3839
* @option name DEPRECATED Name filter

tests/Functional/UpstreamCommandsTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@ public function testUpstreamListCommand()
2727
$this->assertArrayHasKey('label', $upstreamInfo, 'An upstream should have "label" field.');
2828
$this->assertArrayHasKey('machine_name', $upstreamInfo, 'An upstream should have "machine_name" field.');
2929
$this->assertArrayHasKey('type', $upstreamInfo, 'An upstream should have "type" field.');
30+
$this->assertArrayNotHasKey('repository_url', $upstreamInfo, 'An upstream should not have "repository_url" field by default.');
31+
}
32+
33+
/**
34+
* Test UpstreamListCommand with repository_url field
35+
*
36+
* @test
37+
* @covers \Pantheon\Terminus\Commands\Upstream\ListCommand
38+
*
39+
* @group upstream
40+
* @group short
41+
*/
42+
public function testUpstreamListCommandWithRepositoryUrl()
43+
{
44+
$upstreamList = $this->terminusJsonResponse('upstream:list --fields=id,label,repository_url');
45+
$this->assertIsArray($upstreamList);
46+
$upstreamInfo = array_shift($upstreamList);
47+
$this->assertArrayHasKey('id', $upstreamInfo, 'An upstream should have "id" field.');
48+
$this->assertArrayHasKey('label', $upstreamInfo, 'An upstream should have "label" field.');
49+
$this->assertArrayHasKey('repository_url', $upstreamInfo, 'An upstream should have "repository_url" field when explicitly requested.');
3050
}
3151

3252
/**

0 commit comments

Comments
 (0)