-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Adding -Extension and -LeafBase switches to Split-Path #2721
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
Hi @powercode, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
fd24ea2
to
e8e7f40
Compare
It 'Validate LeafBase' { | ||
$result = Split-Path -Path "$level2_1Full$fileExt" -Extension | ||
$result | Should Be $fileExt | ||
} |
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.
should there be explicit tests for things like:
"$level2_1Full$fileExt$fileExt"
to ensure that the trimming is not over-zealous?
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.
e8e7f40
to
ef0abc9
Compare
@@ -37,6 +39,17 @@ public class SplitPathCommand : CoreCommandWithCredentialsBase | |||
private const string leafSet = "LeafSet"; | |||
|
|||
/// <summary> | |||
/// The parameter set name to get the leaf name | |||
/// </summary> | |||
private const string leafBaseSet = "LeafBaseSet"; |
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.
What's the difference between LeafSet and LeafBaseSet?
private const string leafBaseSet = "LeafBaseSet"; | ||
8000 |
|
|
/// <summary> | ||
/// The parameter set name to get the leaf name |
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.
The comment seems to be duplicated.
@@ -154,18 +135,7 @@ public SwitchParameter NoQualifier | |||
/// </value> | |||
/// | |||
[Parameter(ParameterSetName = parentSet, Mandatory = false, ValueFromPipelineByPropertyName = true)] | |||
public SwitchParameter Parent |
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.
The default value of _parent used to be true. The default for a switch is False. Please revisit.
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.
Good catch. Fixing and rebasing.
…No functionallity changes Using auto properties when no when there is no logic in getter/setter Removing unused code Removing redundant qualifiers Removing Redundant initializers
Extension and LeafBase are specializations of Leaf, and uses System.IO.Path.GetExtension and System.IO.Path.GetFilenameWithoutExtension to extract parts from the Leaf
ef0abc9
to
33e266e
Compare
@charub your comments have been addressed, can you please take another look? If the change looks good, please approve the PR. |
Fixes #2700
Extension and LeafBase are specializations of Leaf, and uses System.IO.Path.GetExtension
and System.IO.Path.GetFilenameWithoutExtension to extract parts from the Leaf
Tests added in test\powershell\Modules\Microsoft.PowerShell.Management\FileSystem.Tests.ps1