Skip to content

Instantly share code, notes, and snippets.

@thedavecarroll
Last active July 26, 2020 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedavecarroll/3a498559a47396be70fc3a4f5be0f07f to your computer and use it in GitHub Desktop.
Save thedavecarroll/3a498559a47396be70fc3a4f5be0f07f to your computer and use it in GitHub Desktop.
PowerShell 7 Experimental Features Demo
@{
RootModule = 'DemoModule.psm1'
ModuleVersion = '0.7.0'
CompatiblePSEditions = 'Core'
GUID = 'a007643e-c876-4806-b6cb-367963716e98'
Author = 'Dave'
CompanyName = 'thedavecarroll'
Copyright = '2020 (c) Dave Carroll. All rights reserved.'
PowerShellVersion = '7.0'
FunctionsToExport = 'Show-HelloWorld','Get-LoremIpsum'
PrivateData = @{
PSData = @{
ExperimentalFeatures = @(
@{
Name = 'DemoModule.ExperimentalFunction'
Description = 'Demo of Experimental Functions'
},
@{
Name = 'DemoModule.ExperimentalParameter'
Description = 'Demo of Experimental Parameter'
}
)
}
}
}
function Show-HelloWorld {
[Experimental("DemoModule.ExperimentalFunction", "Show")]
[CmdletBinding()]
param()
'PowerShell 7 is here!' | Write-Host -ForegroundColor Yellow
}
function Show-HelloWorld {
[Experimental("DemoModule.ExperimentalFunction", "Hide")]
[CmdletBinding()]
param()
'PowerShell 7 is shipping soon!' | Write-Host -ForegroundColor Green
}
function Get-LoremIpsum {
[CmdletBinding()]
param(
[Experimental("DemoModule.ExperimentalParameter", "Show")]
[switch]$Show,
[Experimental("DemoModule.ExperimentalParameter", "Hide")]
[switch]$Display
)
if ($Display) {
$Lorem = @()
$Lorem += "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
$Lorem += "Sed varius mi erat, in laoreet nibh eleifend eget."
$Lorem += "Phasellus odio diam, tincidunt rhoncus massa in, feugiat"
$Lorem += "iaculis mauris. Nulla ornare enim et semper tincidunt."
$Lorem += "Maecenas ac tempor quam, in scelerisque lorem."
$Lorem -join ' ' | Write-Output
}
if ($Show) {
'The quick brown fox jumps over the lazy dog.' | Write-Output
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment