[client] Fix multiple peer name filtering in netbird status command #2798
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
Issue ticket number and link
Checklist
Description
The current implementation of peer name filtering in the
skipDetailByFilters
function has a logic issue that prevents filtering by multiple peer names. This PR fixes the issue by:Changing the initial value of
nameEval
totrue
(meaning skip by default)Inverting the logic to look for matches instead of non-matches
Setting
nameEval = false
when a match is found (meaning don't skip)Before the fix:
--filter-by-names peer-01,peer-02.netbird.cloud
, the command would fail to show both peers because:After the fix:
nameEval = true
(skip by default)nameEval
is set to falseExample:
Bash
Now correctly shows both peers that match either name.
Testing:
This fix maintains compatibility with existing functionality while correctly implementing the intended multiple peer name filtering behavior.