Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor output format framework to support tables and empty format #1502

Closed
wants to merge 86 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
979f071
[WIP] [Updated] Issues #1429 and #1440
Mar 31, 2022
7456a23
Merge branch 'redhat-developer:main' into sdpcommandedit
Apr 4, 2022
d6242d9
[WIP] [Updated]: Issues #1429 and #1440
Apr 5, 2022
ffd911e
chore: bazzinga
wtrocki Apr 5, 2022
106a18d
chore: updated fix #1502
Apr 6, 2022
e3d67f5
chore: updated issue #1502
Apr 7, 2022
ce01938
fix: issue #1429 completed, awaiting verification
Apr 7, 2022
2e913a2
fix: support for tables and empty format
Apr 8, 2022
d1e4d95
chore: configure list.go to include table
Apr 12, 2022
02d2057
chore: updated list.go(s)
Apr 12, 2022
86d5edf
chore: updated fix for #1429 and .md files
Apr 19, 2022
ceaacd3
chore: fix and update docs
Apr 20, 2022
5c7a72b
chore: small fix for table option in output view
Apr 21, 2022
34f36bf
fix: update telemetry setup
wtrocki Apr 7, 2022
23b1887
fix: update go in CI/CD workflow (#1514)
wtrocki Apr 8, 2022
7a836a3
chore: update CHANGELOG
wtrocki Apr 8, 2022
93d028b
ci(release): fix unrecognized named-value
rkpattnaik780 Apr 8, 2022
049e10b
fix: update golang version
wtrocki Apr 8, 2022
43f0225
fix: update golang version
wtrocki Apr 8, 2022
8f03e3b
feat(context): add commands for context management
rkpattnaik780 Mar 3, 2022
6fd2dbc
feat(context): add command for context creation
rkpattnaik780 Mar 4, 2022
2698a92
fix(context): fixes bugs and add comments
rkpattnaik780 Mar 4, 2022
f3a9b27
refactor(context): change context to service context
rkpattnaik780 Mar 8, 2022
e7381b4
docs(context): improve help texts and add comments
rkpattnaik780 Mar 8, 2022
2abaa53
feat(context): add command to delete contexts
rkpattnaik780 Mar 9, 2022
f74cafa
fix: add validation for context create
rkpattnaik780 Mar 10, 2022
c1d330a
fix: add migration to the contexts
wtrocki Mar 11, 2022
6b98905
feat: alias status and use commands to context cmds
rkpattnaik780 Mar 15, 2022
5394604
feat(context create): remove setting services
rkpattnaik780 Mar 15, 2022
0d5862b
fix(context): examples of re-used commands
rkpattnaik780 Mar 16, 2022
f5d50a6
fix: address review comments
rkpattnaik780 Mar 16, 2022
5b8b711
fix: rename context maps
rkpattnaik780 Mar 16, 2022
2f0034d
docs(context): change examples
rkpattnaik780 Mar 16, 2022
dc76590
feat(context status): show context name and path
rkpattnaik780 Mar 21, 2022
e82a324
fix: handle custom context location
rkpattnaik780 Mar 22, 2022
22ac2a5
docs: add examples and loading order
rkpattnaik780 Mar 23, 2022
23edf26
refactor(service-registry): get current instance from context file (#…
rkpattnaik780 Mar 23, 2022
6dc22cf
refactor(cluster): use contexts for current instances
rkpattnaik780 Mar 24, 2022
40d4e50
refactor(kafka): get current instance from context file
rkpattnaik780 Mar 25, 2022
ca42b0e
refactor(context): rename profileutil and add flag completions
rkpattnaik780 Mar 28, 2022
ed01878
refactor(context): remove context handler struct
rkpattnaik780 Mar 28, 2022
d0cd302
refactor(context): reuse helper methods
rkpattnaik780 Mar 29, 2022
705aec0
fix: refactor status command
wtrocki Mar 30, 2022
9a5b57e
fix: status builder lint issues
wtrocki Apr 11, 2022
c0cdbb6
chore: update CHANGELOG
wtrocki Apr 11, 2022
3ad5d1e
feat(context): add generate-config command
rkpattnaik780 Mar 30, 2022
16b5727
docs: fix merge conflict
bhardesty Apr 6, 2022
9e9b0ff
fix: regenerate documentation
wtrocki Apr 11, 2022
70d0fe1
feat: token command (#1520)
wtrocki Apr 11, 2022
a99a452
fix: suspend updating modular docs for prereleases (#1521)
wtrocki Apr 11, 2022
9d64762
fix: enable self updating CLI (#1509)
wtrocki Apr 12, 2022
67c4d6d
chore: update CHANGELOG
rkpattnaik780 Apr 18, 2022
92f8c1e
fix(generate-config): change keyname to kafkaHost (#1528)
rkpattnaik780 Apr 20, 2022
618d648
fix: disable check for region (#1527)
wtrocki Apr 20, 2022
36bb6a7
chore: update CHANGELOG
wtrocki Apr 20, 2022
fa22a58
feat: initial implementation for connectors commands
wtrocki Apr 7, 2022
5ad269f
fix: default client
wtrocki Apr 7, 2022
28b25d6
fix: add remaining commands
wtrocki Apr 7, 2022
2ec5101
fix: add messages placeholders
wtrocki Apr 7, 2022
b0d6d74
fix: move messages generator
wtrocki Apr 7, 2022
1795e90
fix: add connectors to root
wtrocki Apr 7, 2022
a36cb62
fix: add example strings
wtrocki Apr 7, 2022
ea82d7e
fix: improve messages
wtrocki Apr 8, 2022
1d70446
fix: add parameters
wtrocki Apr 8, 2022
80550c9
fix: add create support
wtrocki Apr 8, 2022
c691896
fix: use default page size from build
wtrocki Apr 12, 2022
c1faa46
fix: remove invalid char in docs
wtrocki Apr 12, 2022
ff5eee3
fix: map connector status to row (#1518)
lburgazzoli Apr 11, 2022
d0784e3
feat(connector): add update and namespace commands
rkpattnaik780 Apr 13, 2022
f0a21a2
fix: update client to enable using external clients
wtrocki Apr 14, 2022
0dae5ae
fix: expose api config to enable using external clients and APIs (#1523)
lburgazzoli Apr 14, 2022
3610417
feat(connectors): add update cmd and enhance commands
rkpattnaik780 Apr 18, 2022
adbf41c
refactor(connector): rename connectors to connector
rkpattnaik780 Apr 19, 2022
0a516e5
feat(connector namespace): add delete command and refactors
rkpattnaik780 Apr 19, 2022
a4977b0
docs(context): format toml file and change helper text
rkpattnaik780 Apr 19, 2022
d94eb50
refactor(connector): move addon param to cluster cmd
rkpattnaik780 Apr 19, 2022
0b9cffa
fix: build failing at lint
rkpattnaik780 Apr 19, 2022
c328b0b
fix(connector): hide connector commands
rkpattnaik780 Apr 20, 2022
eff3724
fix(connector namespace): add validation
rkpattnaik780 Apr 20, 2022
0b4bdce
feat(service-registry): display compatibile API endpoints
rkpattnaik780 Apr 21, 2022
33ca6e8
fix: address review comments
rkpattnaik780 Apr 21, 2022
3f643cf
fix: change to info from error
rkpattnaik780 Apr 21, 2022
e9ffbaa
fix: change message for compatibility APIs
rkpattnaik780 Apr 22, 2022
0d5ee3e
docs(connector update): change erroneous message
rkpattnaik780 Apr 22, 2022
342c60c
chore: update CHANGELOG
rkpattnaik780 Apr 22, 2022
0f2f8e1
chore: update and fix issues
Apr 25, 2022
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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ generate-downstream-docs: ## Generate command-line reference documentation in ad

I18N_LINTER_DEF := $(shell command -v app-services-go-linter 2> /dev/null)

lint-lang: ## Lint i18n files
ifndef I18N_LINTER_DEF # check if the linter is installed, install it if not
go install github.com/redhat-developer/app-services-go-linter/cmd/app-services-go-linter@latest
endif
app-services-go-linter -path ./pkg/core/localize/locales ./...
.PHONY: lint-lang
# lint-lang: ## Lint i18n files
# ifndef I18N_LINTER_DEF # check if the linter is installed, install it if not
# go install github.com/redhat-developer/app-services-go-linter/cmd/app-services-go-linter@latest
# endif
# app-services-go-linter -path ./pkg/core/localize/locales ./...
# .PHONY: lint-lang

# Check http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_acl_delete.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_acl_list.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_consumer-group_describe.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_consumer-group_list.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_create.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_describe.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_list.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_topic_create.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_topic_describe.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_kafka_topic_list.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/rhoas_service-registry_rule_describe.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/AlecAivazis/survey/v2 v2.3.4
github.com/BurntSushi/toml v1.0.0
github.com/BurntSushi/toml v1.1.0
github.com/MakeNowJust/heredoc v1.0.0
github.com/Nerzal/gocloak/v7 v7.11.0
github.com/aerogear/charmil v0.8.3
Expand All @@ -23,7 +23,7 @@ require (
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5
github.com/pkg/errors v0.9.1
github.com/redhat-developer/app-services-sdk-go/accountmgmt v0.1.0
github.com/redhat-developer/app-services-sdk-go/kafkainstance v0.6.0
github.com/redhat-developer/app-services-sdk-go/kafkainstance v0.5.0
github.com/redhat-developer/app-services-sdk-go/kafkamgmt v0.9.0
github.com/redhat-developer/app-services-sdk-go/registryinstance v0.3.1
github.com/redhat-developer/app-services-sdk-go/registrymgmt v0.6.1
Expand Down
8 changes: 5 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
Expand Down Expand Up @@ -628,8 +629,8 @@ github.com/redhat-developer/app-services-sdk-go v0.10.0 h1:zI0X5FR0NOj6IwBWk3y1T
github.com/redhat-developer/app-services-sdk-go v0.10.0/go.mod h1:enn8Zz6IT0HZYzS6LSttiME2apwnvfVWZnGRS81A4rk=
github.com/redhat-developer/app-services-sdk-go/accountmgmt v0.1.0 h1:MOljVN8AKTM72Yed8ioAwhdW0KdWEhBZjjam3lY2lyY=
github.com/redhat-developer/app-services-sdk-go/accountmgmt v0.1.0/go.mod h1:0LX7ZCEmMKAbncO05/zRYsV0K5wsds7AGPpOFC7KWGo=
github.com/redhat-developer/app-services-sdk-go/kafkainstance v0.6.0 h1:ExEHQaihnPNxN2nKXB0q5nrmSv4p8b3Idzt7TChxv+Q=
github.com/redhat-developer/app-services-sdk-go/kafkainstance v0.6.0/go.mod h1:hMpejngP3BFnifCDH1gKRG9cU9Q4lr0WiQaW7A1LYo4=
github.com/redhat-developer/app-services-sdk-go/kafkainstance v0.5.0 h1:1FMsZfo2xCtYimrBcR+s0O0b0MzxdxiStY8A78oTGBA=
github.com/redhat-developer/app-services-sdk-go/kafkainstance v0.5.0/go.mod h1:UYJgMZWmd238bk6l464U1g8I3YWcEE9PGnjvNRi5Lqw=
github.com/redhat-developer/app-services-sdk-go/kafkamgmt v0.9.0 h1:wb335WbgyhFZRIHOwqHJm+D877l50MPMacrONCmknnw=
github.com/redhat-developer/app-services-sdk-go/kafkamgmt v0.9.0/go.mod h1:Bs/YQI9ZuZLzBoeBAWV6KmkO8Jwm8NcrUn3VFp8eleo=
github.com/redhat-developer/app-services-sdk-go/registryinstance v0.3.1 h1:xRq5XJzRDs/Z7e/9SDt6zbNRIyesC4LTqN9ajHKwjHo=
Expand Down Expand Up @@ -910,6 +911,7 @@ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM=
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
10 changes: 5 additions & 5 deletions pkg/cmd/kafka/acl/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ func NewListACLCommand(f *factory.Factory) *cobra.Command {
flags := flagutil.NewFlagSet(cmd, f)

flags.AddInstanceID(&opts.kafkaID)
flags.AddOutput(&opts.output)

table := dump.TableFormat
flags.AddOutputFormatted(&opts.output, true, &table)
flags.AddPage(&opts.page)
flags.AddSize(&opts.size)
flags.AddUser(&userID)
Expand Down Expand Up @@ -208,14 +210,12 @@ func runList(opts *options) (err error) {
}

switch opts.output {
case dump.EmptyFormat:
case dump.TableFormat:
opts.logger.Info("")
permissions := permissionsData.GetItems()
rows := aclcmdutil.MapACLsToTableRows(permissions, opts.localizer)
wtrocki marked this conversation as resolved.
Show resolved Hide resolved
dump.Table(opts.io.Out, rows)
return dump.Formatted(opts.io.Out, opts.output, rows)
default:
return dump.Formatted(opts.io.Out, opts.output, permissionsData)
}

return nil
}
9 changes: 4 additions & 5 deletions pkg/cmd/kafka/consumergroup/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func NewListConsumerGroupCommand(f *factory.Factory) *cobra.Command {

flags := flagutil.NewFlagSet(cmd, opts.localizer)

flags.AddOutput(&opts.output)
table := dump.TableFormat
flags.AddOutputFormatted(&opts.output, true, &table)
flags.StringVar(&opts.topic, "topic", "", opts.localizer.MustLocalize("kafka.consumerGroup.list.flag.topic.description"))
flags.StringVar(&opts.search, "search", "", opts.localizer.MustLocalize("kafka.consumerGroup.list.flag.search"))
flags.Int32VarP(&opts.page, "page", "", cmdutil.ConvertPageValueToInt32(build.DefaultPageNumber), opts.localizer.MustLocalize("kafka.consumerGroup.list.flag.page"))
Expand Down Expand Up @@ -162,16 +163,14 @@ func runList(opts *options) (err error) {
}

switch opts.output {
case dump.EmptyFormat:
case dump.TableFormat:
opts.Logger.Info("")
consumerGroups := consumerGroupData.GetItems()
rows := mapConsumerGroupResultsToTableFormat(consumerGroups)
dump.Table(opts.IO.Out, rows)
return dump.Formatted(opts.IO.Out, opts.output, rows)
default:
return dump.Formatted(opts.IO.Out, opts.output, consumerGroupData)
}

return nil
}

func mapConsumerGroupResultsToTableFormat(consumerGroups []kafkainstanceclient.ConsumerGroup) []consumerGroupRow {
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/kafka/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func NewListCommand(f *factory.Factory) *cobra.Command {

flags := kafkaFlagutil.NewFlagSet(cmd, opts.localizer)

flags.AddOutput(&opts.outputFormat)
table := dump.TableFormat
flags.AddOutputFormatted(&opts.outputFormat, true, &table)
flags.IntVar(&opts.page, "page", int(cmdutil.ConvertPageValueToInt32(build.DefaultPageNumber)), opts.localizer.MustLocalize("kafka.list.flag.page"))
flags.IntVar(&opts.limit, "limit", 100, opts.localizer.MustLocalize("kafka.list.flag.limit"))
flags.StringVar(&opts.search, "search", "", opts.localizer.MustLocalize("kafka.list.flag.search"))
Expand Down Expand Up @@ -126,20 +127,19 @@ func runList(opts *options) error {
}

switch opts.outputFormat {
case dump.EmptyFormat:
case dump.TableFormat:
var rows []kafkaRow
serviceConfig, _ := opts.Config.Load()
if serviceConfig != nil && serviceConfig.Services.Kafka != nil {
rows = mapResponseItemsToRows(response.GetItems(), serviceConfig.Services.Kafka.ClusterID)
} else {
rows = mapResponseItemsToRows(response.GetItems(), "-")
}
dump.Table(opts.IO.Out, rows)
opts.Logger.Info("")
return dump.Formatted(opts.IO.Out, opts.outputFormat, rows)
default:
return dump.Formatted(opts.IO.Out, opts.outputFormat, response)
}
return nil
}

func mapResponseItemsToRows(kafkas []kafkamgmtclient.KafkaRequest, selectedId string) []kafkaRow {
Expand Down
9 changes: 4 additions & 5 deletions pkg/cmd/kafka/topic/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ func NewListTopicCommand(f *factory.Factory) *cobra.Command {

flags := flagutil.NewFlagSet(cmd, opts.localizer)

flags.AddOutput(&opts.output)
table := dump.TableFormat
flags.AddOutputFormatted(&opts.output, true, &table)
flags.StringVar(&opts.search, "search", "", opts.localizer.MustLocalize("kafka.topic.list.flag.search.description"))
flags.Int32VarP(&opts.page, "page", "", cmdutil.ConvertPageValueToInt32(build.DefaultPageNumber), opts.localizer.MustLocalize("kafka.topic.list.flag.page.description"))
flags.Int32VarP(&opts.size, "size", "", cmdutil.ConvertSizeValueToInt32(build.DefaultPageSize), opts.localizer.MustLocalize("kafka.topic.list.flag.size.description"))
Expand Down Expand Up @@ -167,15 +168,13 @@ func runCmd(opts *options) error {

stdout := opts.IO.Out
switch opts.output {
case dump.EmptyFormat:
case dump.TableFormat:
topics := topicData.GetItems()
rows := mapTopicResultsToTableFormat(topics)
dump.Table(stdout, rows)
return dump.Formatted(stdout, opts.output, rows)
default:
return dump.Formatted(stdout, opts.output, topicData)
}

return nil
}

func mapTopicResultsToTableFormat(topics []kafkainstanceclient.Topic) []topicRow {
Expand Down
5 changes: 2 additions & 3 deletions pkg/cmd/registry/artifact/crud/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ func runList(opts *options) error {
}

switch opts.outputFormat {
case dump.EmptyFormat:
case dump.TableFormat:
rows := mapResponseItemsToRows(response.Artifacts)
dump.Table(opts.IO.Out, rows)
opts.Logger.Info("")
return dump.Formatted(opts.IO.Out, opts.outputFormat, rows)
default:
return dump.Formatted(opts.IO.Out, opts.outputFormat, response)
}

return nil
}

func mapResponseItemsToRows(artifacts []registryinstanceclient.SearchedArtifact) []artifactRow {
Expand Down
8 changes: 3 additions & 5 deletions pkg/cmd/registry/artifact/role/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,13 @@ func runList(opts *options) error {
stdout := opts.IO.Out

switch opts.outputFormat {
case dump.EmptyFormat:
rows := mapResponseItemsToRows(mappings)
dump.Table(opts.IO.Out, rows)
case dump.TableFormat:
opts.Logger.Info("")
rows := mapResponseItemsToRows(mappings)
return dump.Formatted(opts.IO.Out, opts.outputFormat, rows)
default:
return dump.Formatted(stdout, opts.outputFormat, mappings)
}

return nil
}

func mapResponseItemsToRows(artifacts []registryinstanceclient.RoleMapping) []registryRow {
Expand Down
5 changes: 2 additions & 3 deletions pkg/cmd/registry/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,20 @@ func runList(opts *options) error {
}

switch opts.outputFormat {
case dump.EmptyFormat:
case dump.TableFormat:
var rows []RegistryRow
serviceConfig, _ := opts.Config.Load()
if serviceConfig != nil && serviceConfig.Services.ServiceRegistry != nil {
rows = mapResponseItemsToRows(&response.Items, serviceConfig.Services.ServiceRegistry.InstanceID)
} else {
rows = mapResponseItemsToRows(&response.Items, "-")
}
dump.Table(opts.IO.Out, rows)
opts.Logger.Info("")
return dump.Formatted(opts.IO.Out, opts.outputFormat, rows)
default:
return dump.Formatted(opts.IO.Out, opts.outputFormat, response)
}

return nil
}

func mapResponseItemsToRows(registries *[]srsmgmtv1.Registry, selectedId string) []RegistryRow {
Expand Down
5 changes: 2 additions & 3 deletions pkg/cmd/serviceaccount/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,13 @@ func runList(opts *options) (err error) {

outStream := opts.IO.Out
switch opts.output {
case dump.EmptyFormat:
case dump.TableFormat:
rows := mapResponseItemsToRows(serviceaccounts)
dump.Table(outStream, rows)
return dump.Formatted(outStream, opts.output, rows)
default:
return dump.Formatted(opts.IO.Out, opts.output, res)
}

return nil
}

func mapResponseItemsToRows(svcAccts []kafkamgmtclient.ServiceAccountListItem) []svcAcctRow {
Expand Down
Loading