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

Feat/silence print #393

Merged
merged 2 commits into from
May 24, 2021
Merged

Feat/silence print #393

merged 2 commits into from
May 24, 2021

Conversation

hbagdi
Copy link
Member

@hbagdi hbagdi commented May 18, 2021

Fixes #152 #232

@hbagdi hbagdi requested a review from a team as a code owner May 18, 2021 23:19
@hbagdi
Copy link
Member Author

hbagdi commented May 18, 2021

Please review commit by commit.
I'm looking for feedback on:

  • flag naming
  • how to lay out code (continued effort to de-duplicate code)

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2021

Codecov Report

Merging #393 (39571ab) into main (3423945) will increase coverage by 0.01%.
The diff coverage is 26.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #393      +/-   ##
==========================================
+ Coverage   47.02%   47.03%   +0.01%     
==========================================
  Files          87       88       +1     
  Lines        6025     6036      +11     
==========================================
+ Hits         2833     2839       +6     
- Misses       2869     2874       +5     
  Partials      323      323              
Impacted Files Coverage Δ
cmd/common.go 0.00% <0.00%> (ø)
cmd/common_konnect.go 15.21% <0.00%> (+0.63%) ⬆️
cmd/utils.go 22.22% <22.22%> (ø)
cmd/konnect_diff.go 60.86% <25.00%> (-7.56%) ⬇️
cmd/konnect_sync.go 52.63% <25.00%> (-7.37%) ⬇️
cmd/diff.go 73.52% <50.00%> (+0.80%) ⬆️
cmd/sync.go 73.52% <50.00%> (+0.80%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3423945...39571ab. Read the comment docs.

cmd/utils.go Outdated
Comment on lines 30 to 31
set.BoolVar(&silenceEvents, "disable printing events to stdout",
false, "silent events")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the arg order here correct? It looks like you have two usage strings and no name: https://pkg.go.dev/github.com/spf13/pflag#FlagSet.BoolVar

silence-events seems fine if this is only a partial silence. If it's actually everything, then silence.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching that, the last refactor gone wrong. Updated.

This patch also lays out code in a way to avoid duplication across
commands. decK's commands share significant amount of flags and a code
pattern like this can minimize the amount of code and number of code
paths that exist with flag parsing.
@hbagdi hbagdi merged commit 58789ef into main May 24, 2021
@hbagdi hbagdi deleted the feat/silence-print branch May 24, 2021 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants