Skip to content

Commit

Permalink
Paritioning Commands (Fixes #49)
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating authored and StartAutomating committed Jul 29, 2023
1 parent 16a085d commit 5848514
Showing 1 changed file with 91 additions and 72 deletions.
163 changes: 91 additions & 72 deletions docs/Get-Demo.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,106 @@
###
Get-Demo
--------


```PowerShell
function Get-Demo
{
<#
.SYNOPSIS
Gets Demos
.DESCRIPTION
Gets PowerShell Demos.
Demos located in ShowDemo and all modules that tag ShowDemo will be automatically discovered.
.LINK
Import-Demo
.EXAMPLE
Get-Demo
#>
[CmdletBinding(DefaultParameterSetName='LoadedDemos')]
param(
# The name of the demo
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='LoadedDemos')]
[string]
$DemoName,
```

```PowerShell
# The path to the demo file.
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='DemoFile')]
[Alias('FullName', 'DemoFile', 'File', 'Source')]
$DemoPath,
```

```PowerShell
# A Demo Script block.
[Parameter(Mandatory,ValueFromPipeline,ParameterSetName='DemoScript')]
[scriptblock]
$DemoScript
)
```
### Synopsis
Gets Demos

```PowerShell
begin {
$myModule = $MyInvocation.MyCommand.ScriptBlock.Module
}
```

```PowerShell
process {
if ($PSCmdlet.ParameterSetName -in 'DemoFile', 'DemoScript') {
Import-Demo @psboundParameters
return
}
```

---


### Description

Gets PowerShell Demos.
Demos located in ShowDemo and all modules that tag ShowDemo will be automatically discovered.



---


### Related Links
* [Import-Demo](Import-Demo.md)





---


### Examples
#### EXAMPLE 1
```PowerShell
$filePaths =
@(
$pwd
if ($myModule) {
$moduleRelationships = [ModuleRelationships()]$myModule
foreach ($relationship in $moduleRelationships) {
$relationship.RelatedModule | Split-Path
}
} else {
$PSScriptRoot
}
)
Get-Demo
```




---


### Parameters
#### **DemoName**

The name of the demo






|Type |Required|Position|PipelineInput |
|----------|--------|--------|---------------------|
|`[String]`|false |named |true (ByPropertyName)|



#### **DemoPath**

The path to the demo file.






|Type |Required|Position|PipelineInput |Aliases |
|----------|--------|--------|---------------------|-----------------------------------------|
|`[Object]`|true |named |true (ByPropertyName)|FullName<br/>DemoFile<br/>File<br/>Source|



#### **DemoScript**

A Demo Script block.






|Type |Required|Position|PipelineInput |
|---------------|--------|--------|--------------|
|`[ScriptBlock]`|true |named |true (ByValue)|





---


### Syntax
```PowerShell
$allDemoFiles =
all scripts in $filePaths that {
$_.Name -match '^(?>demo|walkthru)\.ps1$' -or
$_.Name -match '\.(?>demo|walkthru)\.ps1$'
} are demofiles
Get-Demo [-DemoName <String>] [<CommonParameters>]
```
```PowerShell
Get-Demo -DemoPath <Object> [<CommonParameters>]
```

```PowerShell
$allDemoFiles |
Where-Object Name -like "*$demoName*" |
Import-Demo
}
}
Get-Demo -DemoScript <ScriptBlock> [<CommonParameters>]
```

0 comments on commit 5848514

Please sign in to comment.