8000 Adding -Extension and -LeafBase switches to Split-Path by powercode · Pull Request #2721 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 3 commits into from
Mar 11, 2017

Conversation

powercode
Copy link
Collaborator

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

@msftclas
Copy link

Hi @powercode, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@powercode powercode changed the title Adding -Exension and -LeafBase switches to Split-Path Adding -Extension and -LeafBase switches to Split-Path Nov 18, 2016
It 'Validate LeafBase' {
$result = Split-Path -Path "$level2_1Full$fileExt" -Extension
$result | Should Be $fileExt
}
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@@ -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";
Copy link
Contributor

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?

8000
private const string leafBaseSet = "LeafBaseSet";

/// <summary>
/// The parameter set name to get the leaf name
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Staffan Gustafsson added 3 commits March 3, 2017 22:34
…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
@powercode powercode force-pushed the split-path-switches branch from ef0abc9 to 33e266e Compare March 4, 2017 04:08
@daxian-dbw
Copy link
Member

@charub your comments have been addressed, can you please take another look? If the change looks good, please approve the PR.

@daxian-dbw daxian-dbw merged commit 220eaa1 into PowerShell:master Mar 11, 2017
@powercode powercode deleted the split-path-switches branch April 19, 2017 17:28
@iSazonov iSazonov removed the Review - Needed The PR is being reviewed label Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0