-
-
Notifications
You must be signed in to change notification settings - Fork 845
Add --filter-by-connection-type flag to status command #4010
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
Add --filter-by-connection-type flag to status command #4010
Conversation
c2e2c4a
to
afe35b5
Compare
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.
@aliamerj I think we can limit this change to the status command only, similar to what we have for the other flags.
There is not much gain in filtering in the daemon/client
It seems like I am becoming blind... please disregard my comment |
@mlsmaycon |
Is there anything should I update here ?? |
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.
left a small comment @aliamerj
client/status/status.go
Outdated
@@ -222,6 +223,9 @@ func mapPeers( | |||
if pbPeerState.Relayed { | |||
connType = "Relayed" | |||
} | |||
if connectionTypeFilter != "" && !strings.EqualFold(connType, connectionTypeFilter) { |
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.
we should move this check into the skipDetailByFilters
to align with current filter processing and output.
Signed-off-by: aliamerj <[email protected]>
afe35b5
to
4d78ec3
Compare
|
I just remembered why I initially didn’t include we only want to skip a peer if its actual connection type doesn't match the filter. So instead of duplicating logic, I introduced a small |
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.
Thanks @aliamerj for the contribution
Describe your changes
This PR introduces a new flag
--filter-by-connection-type
to the status command.It allows users to filter peers by connection type (
P2P
orRelayed
) in both JSON and detailed views.Input validation is added in
parseFilters()
to ensure proper usage, and--detail
is auto-enabled if no output format is specified (consistent with other filters).Issue ticket number and link
Resolves #3883
Stack
Checklist