-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Get-Content -Head and -Tail disallow negative values and cleanup #19715
Conversation
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
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.
Are there tests for the modified scenarios?
Add tests for:
- tail = 0
- verify error when tail is negative
- verify error when totalcount is negative.
@TravisEz13 Added tests |
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
To me this looks like a valid solution , I have added the wg-cmdlets tag because I think the WG should be saying "There are other ways this could be addressed, we like (or don't like) this one." |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
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.
It looks good to me overall. However, this is a breaking change, as today a user can specify negative value like Get-Content -Tail -50
or Get-Content -TotalCount -100
, and they just mean get all content.
It seems to be a bucket 3 breaking change, but I'd like the Cmdlet WG to make a conclusion.
Added to WG agenda |
@PowerShell/wg-powershell-cmdlets reviewed this, we agreed that although a breaking change, we think it is a bucket 3 unlikely to impact users change. The main concern is that |
@JamesWTruher has some individual PR comments he'll add |
@SteveL-MSFT @JamesWTruher I didn't see the new comment above until after I merged the PR ... |
Doc issue MicrosoftDocs/PowerShell-Docs#10183 was opened to track removing mention of the default value. |
@@ -116,15 +79,15 @@ protected override void ProcessRecord() | |||
{ | |||
// TotalCount and Tail should not be specified at the same time. | |||
// Throw out terminating error if this is the case. |
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.
this comment seems wrong - it doesn't look like a terminating error
} | ||
|
||
private bool _totalCountSpecified = false; | ||
public long TotalCount { get; set; } = -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.
hmmm, I wonder if this should be just be long? TotalCount
🎉 Handy links: |
PR Summary
TODO:
Add testsPR Context
#19710 @jhoneill @mklement0
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).