Implemented global --quiet (-q) flag
Fixes https://github.com/civo/cli/issues/497
The PR is divided in two commits -
- centralize the logging. Added a logger.go file in utility package which is being called throughout the codebase, replacing fmt.println() and fmt.printf()
- Actual implementation on top of the first commit.
Working demo ->
Hi @fernando-villalba @uzaxirr please review this :)
Hi @kanha-gupta! Thanks for the contribution and sorry for the delay! We will review this shortly 😄
Unfortunately there are some conflicts with the master branch: you can go ahead and resolve them if you're still interested in contributing, otherwise we can take it from here! 👍
Thanks again!
Hi @giornetta can you take a look at the approach I have taken ? if you like the approach, I'll go ahead and resolve conflicts. Thanks
@kanha-gupta I personally like the approach. @fulviodenza @uzaxirr what's your take?
This approach seems fine. but my only concern is too many files being modified in this PR. Can you divide them?
this MR changes the Printing of the output nesting the --quiet logic, so I cannot imagine a way to divide these files, correct me if I'm wrong @uzaxirr
@alessandroargentieri We can divide this in Multiple PRs, first just a PR to introduce logger in utility and changeing just 2-3 files. and then PRs to change them in resources, ideally i would say one PR for 2 resources.
Hi @giornetta @alessandroargentieri @uzaxirr Thanks for the review ! I can surely divide this PR into smaller ones. just let me know if I should open all the PRs at the same time or one by one. I'll proceed upon your confirmation. Thanks once again !
Not necessary. Me and @uzaxirr clarified on on that point and agreed on merging if you solve the conflicts. Indeed, since it's a single feature, dividing into more than one PR means fragmenting the single feature which is something potentially introducing some refuses.
Not necessary. Me and @uzaxirr clarified on on that point and agreed on merging if you solve the conflicts. Indeed, since it's a single feature, dividing into more than one PR means fragmenting the single feature which is something potentially introducing some refuses.
@alessandroargentieri Thanks for the info. I have resolved merge conflicts. you can merge now :)
I would make sure that every fmt.Printf or other printing functions are replaced with this PR before merging it.
I suppose many new features have been added since this PR was opened, so some new functions may not use this new approach
I wish a rebase has been done and a search all functionality has been used. Isn't it @kanha-gupta ?
I would make sure that every
fmt.Printfor other printing functions are replaced with this PR before merging it.I suppose many new features have been added since this PR was opened, so some new functions may not use this new approach
I would love that too ! unfortunately, I had to leave few modules due to "import cycle" issue during development. These are the following :
- config/config.go
- common/common.go
- cmd/loadbalancer/loadbalancer_remove.go.disabled - left it because it's already disabled, might be useful for future reference ?
Except from these, fmt.Print is refactored in every file. Figured out that I'll have to create a new module just for a logger file so skipped these two. I would appreciate a better approach from your side :)