-
Notifications
You must be signed in to change notification settings - Fork 8.1k
WIP - Implement Get-Hash cmdlet #3395
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
|
RE # 3, try changing the InputString type to |
|
@rkeithhill Thanks for workaround! The code looks not pretty. But I am ready to try this if community votes for this. Can we introduce new public class PSPath : PSObject
{
string Path;
public string ToString()
{
return Path;
}
} |
|
If you look at the SelectStringCommand impl - PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs Line 1009 in 02b5f35
FilenfoToString argument transform attribute on the Path/LiteralPath parameters.
|
|
How do the attribute help to resolve conflict of parameter bindings? |
|
Given that this attribute is private I've not had the chance to use it. However, it makes
|
|
@TravisEz13 I have my hands full and thus re-assigned this PR to you. Could you please help drive it? |
|
I'll continue on next week. |
|
@iSazonov No rush at all 😄 I was the assignee previously but I have too much on my plate right now and thus I reassigned this PR to Travis. That comment is just to let Travis know. |
|
@iSazonov We should close inactive PRs and reopen the PR when it's active. Any issues? |
|
I'm going to give my time and finish my work. |
73a5efc to
8db565d
Compare
|
Ready for a code review. |
|
Please use the present tense, imperative style for commit messages and title per Contribution Guide |
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.
Add a test for piping a file. The equivalent of dir * -File | Get-FileHash
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.
To ensure compatibility
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.
Added the test .
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.
#resolved
|
@BerheAbrha Can you review to ensure this won't cause issues for PowerShell DSC? |
|
You have a test error in travis-ci |
|
@iSazonov merge conflicts need to be resolved |
1. Replace GetFileHashCommand with GetHashCommand 2. Exclude an exception 3. Fix tests.
|
Tests are failing |
|
This is too old code. I will update it. |
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. Thank you for your contributions. |
|
This PR has be automatically close because it is stale. If you wish to continue working on the PR, please first update the PR, then reopen it. |
|
Please reopen this :) |
It is first experimental implementation Get-Hash cmdlet for https://github.com/PowerShell/PowerShell-RFC/blob/master/2-Draft-Accepted/RFC0018-Get-StringHash.md
FileSystemCmdletProviderEncodingbut I had to useEncodingConversion classbecause the API contains useful methods and can be easily enhanced in future (to support full set of codepages). Now multiple Utility cmdlets uses it. In contrast, a code usingFileSystemCmdletProviderEncodingtype is distributed in FileProvider and it's hard to reuse it although it is designated as the preferred (?) in https://github.com/PowerShell/PowerShell-RFC/blob/master/1-Draft/RFC0020-DefaultFileEncoding.md We also talked about that we should rationalize the use of encoding soEncodingConversion classlooks like the best option.ValueFromPipelineByPropertyNametoPathparameter that is skipped in the RFC 0018.After the implementation we can really see thatWe followPathandInputStringparameters have the same type and cannot be bothValueFromPipeline. Perhaps here we understand that it is better for UX to have both options and we should split onGet-FileHashandGet-StringHashstill. Until concluding on this I haven't added pipeline tests.Select-Stringpattern as suggested by @rkeithhill.I wanted to implementWe should follow Unify file encoding when a cmdlet creates a file #4119.ValidateEncodingattribute but was blocked so how to implement Tab Completion. I need help.