Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to pipe file paths to the Include function #289

Open
UberDoodles opened this issue Dec 1, 2019 · 3 comments
Open

Ability to pipe file paths to the Include function #289

UberDoodles opened this issue Dec 1, 2019 · 3 comments

Comments

@UberDoodles
Copy link
Contributor

Expected Behavior

It would be nice to be able to do this :
Get-ChildItem $somePath | Include;

Current Behavior

Currently, you would have to use a more verbose syntax 馃憤
Get-ChildItem $somePath | ForEach-Object {Include $_}

Possible Solution

Should just be a case of adding ValueFromPipeline=$true to the parameter, and putting the function's content into a process block.

I'm happy to implement this; just creating an issue to associate it with. This could probably be applied to other functions too (I've not had a thorough look yet). If I find them I can either add them to this issue, or log separate issues.

Steps to Reproduce (for bugs)

N/A

Context

This is just a minor improvement that makes user's code more concise.

Your Environment

N/A

@devblackops
Copy link
Member

I think this would be a good addition @UberDoodles.

ValueFromPipeline may be all that is required, but if you wanted to make it more robust, you could also check out this article I wrote a while back about working with file paths and the pipeline. https://4sysops.com/archives/process-file-paths-from-the-pipeline-in-powershell-functions/

I don't know if all that extra support is strictly needed in this case but if you want to implement this feature, I'd be all for it.

@UberDoodles
Copy link
Contributor Author

Thanks @devblackops; that's an awesome article. I'll make sure to implement those improvements.

@stale
Copy link

stale bot commented Jan 31, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants