Skip to content

Adding -Extension and -LeafBase switches to Split-Path - #2721

Merged
Dongbo Wang (daxian-dbw) merged 3 commits into
PowerShell:masterfrom
powercode:split-path-switches
Mar 11, 2017
Merged

Adding -Extension and -LeafBase switches to Split-Path#2721
Dongbo Wang (daxian-dbw) merged 3 commits into
PowerShell:masterfrom
powercode:split-path-switches

Conversation

@powercode

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

Hi Staffan Gustafsson (@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 Staffan Gustafsson (powercode) changed the title Adding -Exension and -LeafBase switches to Split-Path Adding -Extension and -LeafBase switches to Split-Path Nov 18, 2016

Copy link
Copy Markdown
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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added.

Copy link
Copy Markdown
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?

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
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
Copy Markdown
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
@daxian-dbw

Copy link
Copy Markdown
Member

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

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 220eaa1 into PowerShell:master Mar 11, 2017
@powercode
Staffan Gustafsson (powercode) deleted the split-path-switches branch April 19, 2017 17:28
@iSazonov Ilya (iSazonov) removed the Review - Needed The PR is being reviewed label Apr 20, 2017
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
* Refactoring ParsePathCommand.cs (SplitPathCommand) for readability
   - Using auto properties when no when there is no logic in getter/setter
   - Removing unused code
   - Removing redundant qualifiers
   - Removing Redundant initializers
* Add -Extension and -Leafbase switches to Split-Path cmdlet
   - Extension and LeafBase are specializations of Leaf, and uses System.IO.Path.GetExtension and System.IO.Path.GetFilenameWithoutExtension to extract parts from the Leaf
* Adding tests for Split-Path -LeafBase and Split-Path -Extension
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