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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Utility of Get-Blank #220

Merged
merged 5 commits into from
Aug 8, 2019
Merged

Improve Utility of Get-Blank #220

merged 5 commits into from
Aug 8, 2019

Conversation

vexx32
Copy link
Owner

@vexx32 vexx32 commented Aug 6, 2019

PR Summary

This PR allows Get-Blank to effectively replace any command in the pipeline, including those that would be used in the middle of a pipeline, or those with parameters.

Context

This is accomplished by offering dummy parameters for both pipeline and regular input. Regular input is taken with ValueFromRemainingArguments so as to capture both arbitrary named parameters and values, without throwing any errors during binding and allowing the assertion to behave correctly.

This allows syntax like this to frame koans:

Get-ChildItem | ____ -First 2 | Should -HaveCount 2

Changes

  • Add two parameters to Get-Blank, one for pipe input, one for input via ValueFromRemainingArguments
  • Add comment based help for Get-Blank in case people get curious. It is a public-facing function, after all.

Checklist

  • Pull Request has a meaningful title.
  • Summarised changes.
  • Pull Request is ready to merge & is not WIP.
  • Added tests / only testable interactively.
    • Make sure you add a new test if old tests do not effectively test the code changed.
  • Added documentation / opened issue to track adding documentation at a later date.

Hide the parameters from tab completion; they should not be visible to users working through the koans as they may cause unnecessary confusion.
Use parameter names that literally cannot be accidentally hit with PS's automatic aliasing
steviecoaster
steviecoaster previously approved these changes Aug 6, 2019
Copy link
Collaborator

@steviecoaster steviecoaster left a comment

Choose a reason for hiding this comment

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

Seems sane to me!

@vexx32 vexx32 merged commit 2fbcaf4 into master Aug 8, 2019
@vexx32 vexx32 deleted the Update-Get-Blank branch August 8, 2019 12:18
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.

None yet

2 participants