Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion pkg/output/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,21 @@ func (t *Table) printCore(writer io.Writer, auto bool) error {

var header []string
var alignment []int
var omitEmptyFilter []string
for i := 0; i < n; i++ {
field := reflect.TypeOf(t.objects[0]).Elem().Field(i)
tag := strings.Split(field.Tag.Get(t.format.String()), ",")

if !slices.Contains(tag, "-") {
header = append(header, tag[0])
isBoolType := field.Type.Kind() == reflect.Bool
includeColumn := slices.ContainsFunc(t.objects, func(object any) bool {
val := reflect.ValueOf(object).Elem().Field(i)
return !(slices.Contains(tag, "omitempty") && isZero(val))
})
if isBoolType || includeColumn {
header = append(header, tag[0])
omitEmptyFilter = append(omitEmptyFilter, field.Name)
}

switch field.Type.Kind() {
case reflect.Int, reflect.Int32, reflect.Int64:
Expand All @@ -182,6 +191,13 @@ func (t *Table) printCore(writer io.Writer, auto bool) error {
}
w.SetHeader(header)
w.SetColumnAlignment(alignment)
for i := range t.objects {
hider := FieldHider{
format: t.format,
filter: &omitEmptyFilter,
}
t.objects[i] = retag.Convert(t.objects[i], hider)
}

for _, object := range t.objects {
var row []string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Plugin ID | Plugin Name | ID | Version | Content Format | Documentation Link | Sensitive Config Properties | Connector Classes | Phase | Error Message | Environment
-------------+---------------+------------+---------+----------------+---------------------------+-----------------------------+------------------------------------------------------------+-------+---------------+--------------
ccp-123456 | CliPluginTest | ver-123456 | 1.0.0 | ZIP | https://docs.confluent.io | password, secret | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | | env-596
ccp-123456 | CliPluginTest | ver-789012 | 2.0.0 | JAR | | | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | | env-596
Plugin ID | Plugin Name | ID | Version | Content Format | Documentation Link | Sensitive Config Properties | Connector Classes | Phase | Environment
-------------+---------------+------------+---------+----------------+---------------------------+-----------------------------+------------------------------------------------------------+-------+--------------
ccp-123456 | CliPluginTest | ver-123456 | 1.0.0 | ZIP | https://docs.confluent.io | password, secret | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | env-596
ccp-123456 | CliPluginTest | ver-789012 | 2.0.0 | JAR | | | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | env-596
8 changes: 4 additions & 4 deletions test/fixtures/output/ccpm/plugin-version-list.golden
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Plugin ID | Plugin Name | ID | Version | Content Format | Documentation Link | Sensitive Config Properties | Connector Classes | Phase | Error Message | Environment
-------------+---------------+------------+---------+----------------+---------------------------+-----------------------------+------------------------------------------------------------+-------+---------------+--------------
ccp-123456 | CliPluginTest | ver-123456 | 1.0.0 | ZIP | https://docs.confluent.io | password, secret | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | | env-123456
ccp-123456 | CliPluginTest | ver-789012 | 2.0.0 | JAR | | | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | | env-123456
Plugin ID | Plugin Name | ID | Version | Content Format | Documentation Link | Sensitive Config Properties | Connector Classes | Phase | Environment
-------------+---------------+------------+---------+----------------+---------------------------+-----------------------------+------------------------------------------------------------+-------+--------------
ccp-123456 | CliPluginTest | ver-123456 | 1.0.0 | ZIP | https://docs.confluent.io | password, secret | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | env-123456
ccp-123456 | CliPluginTest | ver-789012 | 2.0.0 | JAR | | | io.confluent.kafka.connect.datagen.DatagenConnector:SOURCE | READY | env-123456
10 changes: 5 additions & 5 deletions test/fixtures/output/connect/cluster/list.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ID | Name | Status | Type | Trace
----------+----------------+---------+------+--------
lcc-111 | az-connector-2 | RUNNING | Sink |
lcc-112 | az-connector-3 | RUNNING | Sink |
lcc-123 | az-connector | RUNNING | Sink |
ID | Name | Status | Type
----------+----------------+---------+-------
lcc-111 | az-connector-2 | RUNNING | Sink
lcc-112 | az-connector-3 | RUNNING | Sink
lcc-123 | az-connector | RUNNING | Sink
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name | Path | Format | Backoff Limit | Creation Timestamp | UID
------------------+---------+-----------+---------------+-------------------------------+------
test-savepoint1 | abc/def | CANONICAL | 10 | 2025-03-12 23:42:00 +0000 UTC |
test-savepoint2 | abc/def | CANONICAL | 10 | 2025-03-12 23:42:00 +0000 UTC |
test-savepoint3 | abc/def | CANONICAL | 10 | 2025-03-12 23:42:00 +0000 UTC |
Name | Path | Format | Backoff Limit | Creation Timestamp
------------------+---------+-----------+---------------+--------------------------------
test-savepoint1 | abc/def | CANONICAL | 10 | 2025-03-12 23:42:00 +0000 UTC
test-savepoint2 | abc/def | CANONICAL | 10 | 2025-03-12 23:42:00 +0000 UTC
test-savepoint3 | abc/def | CANONICAL | 10 | 2025-03-12 23:42:00 +0000 UTC
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name | Application | Statement | Path | Format | Backoff Limit | UID | State
------------------+-------------+------------+---------+-----------+---------------+-----+--------
test-savepoint1 | | statement1 | abc/def | CANONICAL | 10 | |
test-savepoint2 | | statement1 | abc/def | CANONICAL | 10 | |
test-savepoint3 | | statement1 | abc/def | CANONICAL | 10 | |
Name | Statement | Path | Format | Backoff Limit
------------------+------------+---------+-----------+----------------
test-savepoint1 | statement1 | abc/def | CANONICAL | 10
test-savepoint2 | statement1 | abc/def | CANONICAL | 10
test-savepoint3 | statement1 | abc/def | CANONICAL | 10
10 changes: 5 additions & 5 deletions test/fixtures/output/flink/savepoint/list-successful.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name | Application | Statement | Path | Format | Backoff Limit | UID | State
------------------+--------------+-----------+---------+-----------+---------------+-----+--------
test-savepoint1 | application1 | | abc/def | CANONICAL | 10 | |
test-savepoint2 | application1 | | abc/def | CANONICAL | 10 | |
test-savepoint3 | application1 | | abc/def | CANONICAL | 10 | |
Name | Application | Path | Format | Backoff Limit
------------------+--------------+---------+-----------+----------------
test-savepoint1 | application1 | abc/def | CANONICAL | 10
test-savepoint2 | application1 | abc/def | CANONICAL | 10
test-savepoint3 | application1 | abc/def | CANONICAL | 10
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ID | Name | Environment | Gateway | Phase | AWS VPC Endpoint Service | AWS VPC Endpoint | AWS VPC Endpoint DNS Name | Azure Private Link Service | Azure Private Link Subresource | Azure Private Endpoint | Azure Private Endpoint Domain | Azure Private Endpoint IP | Azure Private Endpoint Custom | GCP Private Service Connect | GCP Private Service Connect | GCP Private Service Connect | GCP Private Service Connect | High Availability
| | | | | | | | | Name | | | Address | DNS Config Domains | Endpoint Target | Endpoint Connection ID | Endpoint Name | Endpoint IP Address |
-----------+------------------------------+-------------+----------+-------+---------------------------------------------------------+------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------+--------------------------------+------------------------+-------------------------------+--------------------------------+------------------------------------+-----------------------------------------------------------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------
ap-12345 | my-aws-egress-access-point | env-596 | gw-12345 | READY | com.amazonaws.vpce.us-west-2.vpce-svc-00000000000000000 | vpc-endpoint-id | vpc-endpoint-dns-name | | | | | | | | | | | true
ap-67890 | my-azure-egress-access-point | env-596 | gw-12345 | READY | | | | /subscriptions/0000000/resourceGroups/plsRgName/providers/Microsoft.Network/privateLinkServices/privateLinkServiceName | subresource | private-endpoint-id | domain.com | 10.2.0.68 | dbname.database.windows.net, | | | | | false
| | | | | | | | | | | | | dbname-region.database.windows.net | | | | |
ap-88888 | my-gcp-egress-access-point | env-596 | gw-12345 | READY | | | | | | | | | | projects/projectName/regions/us-central1/serviceAttachments/serviceAttachmentName | | | | false
ID | Name | Environment | Gateway | Phase | AWS VPC Endpoint Service | AWS VPC Endpoint | AWS VPC Endpoint DNS Name | Azure Private Link Service | Azure Private Link Subresource | Azure Private Endpoint | Azure Private Endpoint Domain | Azure Private Endpoint IP | Azure Private Endpoint Custom | GCP Private Service Connect | High Availability
| | | | | | | | | Name | | | Address | DNS Config Domains | Endpoint Target |
-----------+------------------------------+-------------+----------+-------+---------------------------------------------------------+------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------+--------------------------------+------------------------+-------------------------------+--------------------------------+------------------------------------+-----------------------------------------------------------------------------------+--------------------
ap-12345 | my-aws-egress-access-point | env-596 | gw-12345 | READY | com.amazonaws.vpce.us-west-2.vpce-svc-00000000000000000 | vpc-endpoint-id | vpc-endpoint-dns-name | | | | | | | | true
ap-67890 | my-azure-egress-access-point | env-596 | gw-12345 | READY | | | | /subscriptions/0000000/resourceGroups/plsRgName/providers/Microsoft.Network/privateLinkServices/privateLinkServiceName | subresource | private-endpoint-id | domain.com | 10.2.0.68 | dbname.database.windows.net, | | false
| | | | | | | | | | | | | dbname-region.database.windows.net | |
ap-88888 | my-gcp-egress-access-point | env-596 | gw-12345 | READY | | | | | | | | | | projects/projectName/regions/us-central1/serviceAttachments/serviceAttachmentName | false
Loading