Skip to content

Change the output of import commands to return arrays - #365

Merged
chenbh merged 2 commits into
mainfrom
import_output
Jan 23, 2024
Merged

Change the output of import commands to return arrays#365
chenbh merged 2 commits into
mainfrom
import_output

Conversation

@xtreme-shane-lattanzio

Copy link
Copy Markdown
Contributor

Resolves #167

@xtreme-shane-lattanzio
xtreme-shane-lattanzio requested a review from a team as a code owner October 11, 2023 19:25
Comment thread pkg/commands/builder/create.go Outdated
Comment thread pkg/commands/builder/create.go
Comment thread pkg/commands/command_helper.go Outdated
err = json.Indent(&buf, data, "", " ")
if err != nil {
return err
for _, obj := range objs {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this change needed? json.Marshal should automatically add the start and ending brackets when passed in a slice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Each object is json but the whole thing is not so if you try to marshal it, it fails

Comment thread pkg/commands/import/import_test.go Outdated

@chenbh chenbh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@chenbh
chenbh merged commit 7382a9c into main Jan 23, 2024
@chenbh
chenbh deleted the import_output branch January 23, 2024 21:23
neil-hickey pushed a commit to neil-hickey/kpack-cli that referenced this pull request Jan 13, 2026
…/import_output

Change the output of import commands to return arrays
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.

--output json should always create a single object

2 participants