Adding SkipIndex parameter to Select-Object#7483
Adding SkipIndex parameter to Select-Object#7483daxian-dbw merged 4 commits intoPowerShell:masterfrom
Conversation
dantraMSFT
left a comment
There was a problem hiding this comment.
Other than a couple of suggestions; LGTM
| } | ||
|
|
||
| /// <summary> | ||
| /// Used to display all objects not at specified index. |
There was a problem hiding this comment.
Minor grammar suggestion:
Used to display all objects not at the specified indices.
| } | ||
| } | ||
|
|
||
| private int _indexOfCurrentObject; |
There was a problem hiding this comment.
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.
Currently we use new syntax:
$results | Should -HaveCount 1Below too.
There was a problem hiding this comment.
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