-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add Culture parameter to Select-String cmdlet #10943
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 Culture parameter to Select-String cmdlet #10943
Conversation
src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/Select-String.Tests.ps1
Outdated
Show resolved
Hide resolved
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.
Please address Codacy issues
I fix one but second impossible (interface implementation). |
30524de to
aa9cc09
Compare
| StringComparison compareOption = CaseSensitive ? | ||
| StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase; | ||
| while (patternIndex < Pattern.Length) | ||
| { |
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 old 'StringComparison compareOption = ...' code can be removed.
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.
Done.
|
@iSazonov Can you respond to comment from @PaulHigin |
|
@adityapatwardhan Paul's comment addressed. Doc issue was filled. |
| /// <summary> | ||
| /// Get list of valid culture names for ValidateSet attribute. | ||
| /// </summary> | ||
| public class ValidateMatchStringCultureNamesGenerator : IValidateSetValuesGenerator |
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.
Can this be internal?
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 must be public:
PowerShell/src/System.Management.Automation/engine/Attributes.cs
Lines 1715 to 1723 in fe40fbf
| public ValidateSetAttribute(Type valuesGeneratorType) | |
| { | |
| // We check 'IsNotPublic' because we don't want allow 'Activator.CreateInstance' create an | |
| // instance of non-public type. | |
| if (!typeof(IValidateSetValuesGenerator).IsAssignableFrom( | |
| valuesGeneratorType) || valuesGeneratorType.IsNotPublic) | |
| { | |
| throw PSTraceSource.NewArgumentException(nameof(valuesGeneratorType)); | |
| } |
|
@iSazonov Please respond the comment from @TravisEz13 |
|
🎉 Handy links: |
PR Summary
Fix #8180
Add new
Cultureparameter to Select-String cmdlet.PR Context
Implement PowerShell/PowerShell-RFC#167 for Select-String cmdlet.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.