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: modify output formatting of info command #2592

Merged

Conversation

ihac
Copy link
Contributor

@ihac ihac commented Dec 20, 2018

Signed-off-by: Xiao An hac@zju.edu.cn

Ⅰ. Describe what this PR did

Remove redundant spaces by refactoring output formatting of pouch info subcommand.

E.g., fmt.Fprintln(os.Stdout, "Containers: ", info.Containers):
since fmt.Fprintln() insert spaces between operands automatically, there will be 2 spaces between "Containers:" and the number of containers. Besides, I think using string formatting (fmt.Fprintf) would be a little bit more intuitive than string concatenation.

Ⅱ. Does this pull request fix one issue?

No.

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

No need.

Ⅳ. Describe how to verify it

No need.

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Dec 20, 2018

Codecov Report

Merging #2592 into master will decrease coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #2592     +/-   ##
========================================
- Coverage    69.4%   69.3%   -0.1%     
========================================
  Files         279     279             
  Lines       18825   18825             
========================================
- Hits        13065   13047     -18     
- Misses       4287    4303     +16     
- Partials     1473    1475      +2
Flag Coverage Δ
#criv1alpha1test 31.74% <ø> (-0.13%) ⬇️
#criv1alpha2test 36.03% <ø> (-0.05%) ⬇️
#integrationtest 41.13% <ø> (-0.03%) ⬇️
#nodee2etest 33.15% <ø> (-0.03%) ⬇️
#unittest 26.75% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pkg/streams/utils.go 82.14% <0%> (-9.53%) ⬇️
daemon/mgr/snapshot.go 89.85% <0%> (-4.35%) ⬇️
ctrd/watch.go 81.69% <0%> (-2.82%) ⬇️
daemon/mgr/container.go 58.58% <0%> (-0.43%) ⬇️
ctrd/container.go 58.89% <0%> (-0.4%) ⬇️
cri/v1alpha1/cri.go 60.26% <0%> (-0.34%) ⬇️
cri/v1alpha2/cri.go 68.68% <0%> (ø) ⬆️
cri/v1alpha2/cri_wrapper.go 66.8% <0%> (+1.2%) ⬆️

@pouchrobot
Copy link
Collaborator

We found this is your first time to contribute to Pouch, @ihac
👏 We really appreciate it.
Just remind that you have read the contribution guide: https://github.com/alibaba/pouch/blob/master/CONTRIBUTING.md
If you didn't, you should do that first. If done, welcome again and please enjoy hacking! 🍻

fmt.Fprintf(os.Stdout, "Name: %s\n", info.Name)
fmt.Fprintf(os.Stdout, "Server Version: %s\n", info.ServerVersion)
fmt.Fprintf(os.Stdout, "Storage Driver: %s\n", info.Driver)
fmt.Fprintf(os.Stdout, "Driver Status: %v\n", info.DriverStatus)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be better to print a list of items one by one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, I think we can use loop to print each item in list. However, I don't know how to use the field by integration side. We need to know the usage before changing the behavior.

@ihac ihac force-pushed the refactor_output_formatting branch 2 times, most recently from 22e65f6 to 9ac39cc Compare December 20, 2018 14:25
Signed-off-by: Xiao An <hac@zju.edu.cn>
@ihac ihac force-pushed the refactor_output_formatting branch from 9ac39cc to 0bc361d Compare December 20, 2018 14:26
@Ace-Tang
Copy link
Contributor

Well, the PR remind me that if we can change pouch info behavior use template.Template like pouch inspect $id, so fmt.Println can be removed.

@allencloud
Copy link
Collaborator

For the update this pr involved, LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Dec 24, 2018
@allencloud allencloud merged commit b357815 into AliyunContainerService:master Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/cli kind/refactor LGTM one maintainer or community participant agrees to merge the pull reuqest. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants