Skip to content

Library for creating PowerShell dynamic parameters for binary cmdlets

License

Notifications You must be signed in to change notification settings

fireflycons/PSDynamicParameters

Repository files navigation

Firefly.PowerShell.DynamicParameters

Build status

Nuget

A library for the creation of runtime dynamic parameters for binary cmdlets.

When creating a binary cmdlet, there are two ways that you can declare dynamic parameters:

  1. When you know all the parameters you'll ever need at compile time, you can declare each parameter type in its own class. An example of this can be found in this PowerShell Magazine article
  2. When you don't necessarily know what parameters you'll need and you will create them on the fly in response to the values passed to the cmdlet's fixed arguments, then we need to create a RuntimeDefinedParameterDictionary.

This library handles the second case above. By implementing a builder pattern to create new dynamic paramaters, this makes it easy to manage the myriad attributes that may be applied to a cmdlet parameter.

Supported PowerShell Versions

The nuget package contains the following builds

  • .NET Framework 4.0 - Windows PowerShell 5.1
  • .NET Core 2.1 - PowerShell Core 6 (Windows/Linux/MacOS) - With PS 6 features.
  • .NET Core 3.1 - PowerShell Core 7 (Windows/Linux/MacOS) - With PS 7 Features
  • .NET Standard 2.0 - Powershell >= 5.1 (Cross Platform) - PS 5.1 features

Tests are run on all three platforms for both PowerShell Core versions.

Library Documentation

API documentation and example usage can be found here.

About

Library for creating PowerShell dynamic parameters for binary cmdlets

Resources

License

Stars

Watchers

Forks

Packages

No packages published