-
Notifications
You must be signed in to change notification settings - Fork 61
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
Support yaml output #241
Support yaml output #241
Conversation
Every command need to have support for yaml output. |
cmd/harbor/root/registry/list.go
Outdated
if FormatFlag == "yaml" { | ||
utils.PrintPayloadInYAMLFormat(registry) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have finalized the subcommand list
for project
, registry
, and user
. I would like to confirm that this is accurate before moving on to support the remaining commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I use a generic function to unify the output in both YAML and JSON formats?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JianMinTang thanks for the contribution. I found some commands still need additional formats. adding formats for those commands would be better.
commands need to be covered are
- artifact
- info
- tags (these have issue with output)
❯ ./harbor-dev artifact tags list
INFO[0003] [0xc000695e60]
❯ ./harbor-dev artifact tags list -o yaml
INFO[0002] [0xc000034ba0]
-
project
- view (also lacks table format)
-
registry
- info (lacks table format)
-
repo
- info (also lacks table format)
Hi @bupd and @Vad1mo, I am a bit confused about the difference between list and info under the same command. If there is any difference in the information they display, could you clearly explain the distinction between them? I created a sample, but I think the Maybe the My suggestion might not be correct, So I am open to receiving your suggestions and guidance on this issue. |
./harbor-dev catalog
we still not have catalog command. we sure need one in the future. |
we can rename the |
SO, @JianMinTang
|
948eeba
to
8262575
Compare
Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]>
* generate credential name Signed-off-by: bupd <[email protected]> * feat: add support for the password-stdin flag in login flow Signed-off-by: karanngi <[email protected]> * fix deps - fixes dependencies Signed-off-by: bupd <[email protected]> * return stdout for tests Signed-off-by: bupd <[email protected]> * update workflow Signed-off-by: bupd <[email protected]> --------- Signed-off-by: bupd <[email protected]> Signed-off-by: karanngi <[email protected]> Co-authored-by: karanngi <[email protected]> Signed-off-by: JianMinTang <[email protected]>
print test output to screen Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]> Add more detail on repo view Signed-off-by: JianMinTang <[email protected]> Support table format on registry view Signed-off-by: JianMinTang <[email protected]> Support table format on project view Signed-off-by: JianMinTang <[email protected]> Fixed tags list Signed-off-by: JianMinTang <[email protected]> Support table format and YAML/JSON output on artifact view Signed-off-by: JianMinTang <[email protected]> Fixed alignment problem Signed-off-by: JianMinTang <[email protected]> Fixed the code format Signed-off-by: JianMinTang <[email protected]>
* generate credential name Signed-off-by: bupd <[email protected]> * feat: add support for the password-stdin flag in login flow Signed-off-by: karanngi <[email protected]> * fix deps - fixes dependencies Signed-off-by: bupd <[email protected]> * return stdout for tests Signed-off-by: bupd <[email protected]> * update workflow Signed-off-by: bupd <[email protected]> --------- Signed-off-by: bupd <[email protected]> Signed-off-by: karanngi <[email protected]> Co-authored-by: karanngi <[email protected]> Signed-off-by: JianMinTang <[email protected]>
print test output to screen Signed-off-by: JianMinTang <[email protected]>
Signed-off-by: JianMinTang <[email protected]> Use gofmt to format all code Signed-off-by: JianMinTang <[email protected]> fix: Support YAML output for additional commands Signed-off-by: JianMinTang <[email protected]> fix: Implement a generic function to format output Signed-off-by: JianMinTang <[email protected]> chore: fix the problem about golangci-lint Signed-off-by: JianMinTang <[email protected]>
8262575
to
92b09c8
Compare
Hi @bupd, I’ve added the table format and YAML/JSON output to some commands, following your suggestions. Thank you so much for your valuable input! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
* Support yaml output for 'registry list' Signed-off-by: JianMinTang <[email protected]> * Use gofmt to format all code Signed-off-by: JianMinTang <[email protected]> * fix: Support YAML output for additional commands Signed-off-by: JianMinTang <[email protected]> * fix: Support YAML format on artiface and repo command Signed-off-by: JianMinTang <[email protected]> * fix: Implement a generic function to format output Signed-off-by: JianMinTang <[email protected]> * chore: fix the problem about golangci-lint Signed-off-by: JianMinTang <[email protected]> * AutoGenerate credential name in login (goharbor#250) * generate credential name Signed-off-by: bupd <[email protected]> * feat: add support for the password-stdin flag in login flow Signed-off-by: karanngi <[email protected]> * fix deps - fixes dependencies Signed-off-by: bupd <[email protected]> * return stdout for tests Signed-off-by: bupd <[email protected]> * update workflow Signed-off-by: bupd <[email protected]> --------- Signed-off-by: bupd <[email protected]> Signed-off-by: karanngi <[email protected]> Co-authored-by: karanngi <[email protected]> Signed-off-by: JianMinTang <[email protected]> * print test output to screen (goharbor#254) print test output to screen Signed-off-by: JianMinTang <[email protected]> * Support table format for repo view and add some comments on repo list Signed-off-by: JianMinTang <[email protected]> Add more detail on repo view Signed-off-by: JianMinTang <[email protected]> Support table format on registry view Signed-off-by: JianMinTang <[email protected]> Support table format on project view Signed-off-by: JianMinTang <[email protected]> Fixed tags list Signed-off-by: JianMinTang <[email protected]> Support table format and YAML/JSON output on artifact view Signed-off-by: JianMinTang <[email protected]> Fixed alignment problem Signed-off-by: JianMinTang <[email protected]> Fixed the code format Signed-off-by: JianMinTang <[email protected]> * AutoGenerate credential name in login (goharbor#250) * generate credential name Signed-off-by: bupd <[email protected]> * feat: add support for the password-stdin flag in login flow Signed-off-by: karanngi <[email protected]> * fix deps - fixes dependencies Signed-off-by: bupd <[email protected]> * return stdout for tests Signed-off-by: bupd <[email protected]> * update workflow Signed-off-by: bupd <[email protected]> --------- Signed-off-by: bupd <[email protected]> Signed-off-by: karanngi <[email protected]> Co-authored-by: karanngi <[email protected]> Signed-off-by: JianMinTang <[email protected]> * print test output to screen (goharbor#254) print test output to screen Signed-off-by: JianMinTang <[email protected]> * Support yaml output for 'registry list' Signed-off-by: JianMinTang <[email protected]> Use gofmt to format all code Signed-off-by: JianMinTang <[email protected]> fix: Support YAML output for additional commands Signed-off-by: JianMinTang <[email protected]> fix: Implement a generic function to format output Signed-off-by: JianMinTang <[email protected]> chore: fix the problem about golangci-lint Signed-off-by: JianMinTang <[email protected]> --------- Signed-off-by: JianMinTang <[email protected]> Signed-off-by: bupd <[email protected]> Signed-off-by: karanngi <[email protected]> Co-authored-by: Prasanth B <[email protected]> Co-authored-by: karanngi <[email protected]> Co-authored-by: Vadim Bauer <[email protected]> Signed-off-by: Patrick Eschenbach <[email protected]>
Fixed #240
Support yaml output for the command
registry list