-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Adding SkipIndex parameter to Select-Object #7483
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
Conversation
dantraMSFT
left a comment
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.
Other than a couple of suggestions; LGTM
| } | ||
|
|
||
| /// <summary> | ||
| /// Used to display all objects not at specified index. |
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.
Minor grammar suggestion:
Used to display all objects not at the specified indices.
| } | ||
| } | ||
|
|
||
| private int _indexOfCurrentObject; |
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.
Suggestion:
To me these field names are confusing. _indexOfCurrentObject implies the object being processed but is actually the index into the array of index filters while _indexCount is the index of the object being processed.
I think it would improve readability if you consider changing these names to something like the following, or some variation:
_currentObjectIndex - the index of the object being processed.
_currentFilterIndex - the index of the active index filter.
|
|
||
| It "Select-Object with SkipIndex should work" { | ||
| $results = "1", "2", "3" | Select-Object -SkipIndex 0, 2 | ||
| $results.Count | Should -Be 1 |
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.
Currently we use new syntax:
$results | Should -HaveCount 1Below too.
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.
Didn't know. Fixing.
|
I edited the PR description to auto close the issue. |
|
@powercode Thanks for the enhancement! |
PR Summary
Resolves #7278.
Adds a parameter
-SkipIndexto theSelect-Objectcmdlet. The semantics are the opposite of the-Indexparameter. All items are passed thru except for the indices specified to-SkipIndex.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests