PowerShell / Operation-Validation-Framework

MIT License
225 stars 32 forks source link

Proposal: Extend Get-OperationValidation to allow LiteralPaths #20

Closed glatzert closed 7 years ago

glatzert commented 7 years ago

Since I stumbled upon this yesterday (#19), I took a look into Get-OperationValidation and I think it's very easy to allow LiteralPaths as a second Parameter-Set.

I'd be happy to provide an appropriate PR, if you'd consider this to be a use case for OV.

devblackops commented 7 years ago

I think being able to provide the path to a module outside of your PSModulePath is a valid use case. Feel free to send in PR.

Support should also be added to Invoke-OperationValidation as you can run that cmdlet directly without first getting the tests via Get-OperationValidation. Perhaps a parameter name of ModulePath?

devblackops commented 7 years ago

@glatzert Check out the feat/literalpath branch I just committed which adds support for this. This basically makes it so using the -ModuleName parameter tells OVF to search in $env:PSModulePath (current behaviour). Using -Path or -LiteralPath tells OVF to search in specific paths for the modules.

ModuleName, Path, and LiteralPath are separate parameter sets so only work will work at a time.

Usage

Get-OperationValidation

Using -Path (globbing is supported)

$tests = gi '.\mycustommodulepath' | Get-OperationValidation
$tests = Get-OperationValidation -Path '.\mycustommod*'

Using -LiteralPath

$tests = Get-OperationValidation -LiteralPath '.\mycustommodulepath'

Invoke-OperationValidation

Using -Path (globbing is supported)

$results = gi '.\mycustommodulepath' | Invoke-OperationValidation
$results = Invoke-OperationValidation -Path '.\mycustommodulepath'

Using -LiteralPath

$results = Invoke-OperationValidation -LiteralPath '.\mycustommodulepath'
glatzert commented 7 years ago

@devblackops that really looks promising for my use case 👍 I hope, i'll have time to check it out this week.

devblackops commented 7 years ago

Fixed in #26