| | | 1 | | |
| | | 2 | | <# |
| | | 3 | | .SYNOPSIS |
| | | 4 | | Get a set of documentation for Kestrun commands. |
| | | 5 | | |
| | | 6 | | .DESCRIPTION |
| | | 7 | | This function retrieves a set of documentation for Kestrun commands based on the specified context. |
| | | 8 | | .PARAMETER Name |
| | | 9 | | The name of the documentation set to retrieve. |
| | | 10 | | .PARAMETER Module |
| | | 11 | | The name of the module to search for commands. |
| | | 12 | | .PARAMETER IncludeNonExported |
| | | 13 | | Whether to include non-exported commands in the search. |
| | | 14 | | .EXAMPLE |
| | | 15 | | # All Definition-only commands (pure) |
| | | 16 | | Get-KrDocSet -Name DefinitionOnly |
| | | 17 | | .EXAMPLE |
| | | 18 | | # All commands that are *only* Route |
| | | 19 | | Get-KrDocSet -Name RouteOnly |
| | | 20 | | .EXAMPLE |
| | | 21 | | # All Route+Schedule commands (pure composite) |
| | | 22 | | Get-KrDocSet -Name RouteAndSchedule |
| | | 23 | | .EXAMPLE |
| | | 24 | | # Everything usable in runtime (pure composite of Route|Schedule) |
| | | 25 | | Get-KrDocSet -Name Runtime |
| | | 26 | | .EXAMPLE |
| | | 27 | | # All config-only commands (pure Definition, no runtime use) |
| | | 28 | | Get-KrDocSet -Name ConfigOnly |
| | | 29 | | #> |
| | | 30 | | function Get-KrDocSet { |
| | | 31 | | [CmdletBinding()] |
| | | 32 | | param( |
| | | 33 | | [Parameter(Mandatory)] |
| | | 34 | | [ValidateSet( |
| | | 35 | | 'DefinitionOnly', |
| | | 36 | | 'RouteOnly', |
| | | 37 | | 'ScheduleOnly', |
| | | 38 | | 'RouteAndSchedule', |
| | | 39 | | 'ScheduleAndDefinition', |
| | | 40 | | 'Runtime', # Route|Schedule |
| | | 41 | | 'Everywhere', |
| | | 42 | | 'ConfigOnly' # Definition but not Route/Schedule |
| | | 43 | | )] |
| | | 44 | | [string]$Name, |
| | | 45 | | |
| | | 46 | | [string]$Module = 'Kestrun', |
| | | 47 | | [switch]$IncludeNonExported, |
| | | 48 | | [object[]]$Functions |
| | | 49 | | ) |
| | | 50 | | |
| | 0 | 51 | | switch ($Name) { |
| | | 52 | | 'DefinitionOnly' { |
| | 0 | 53 | | Get-KrCommandsByContext -AnyOf Definition -Exact -Module $Module -IncludeNonExported:$IncludeNonExported -Fu |
| | | 54 | | } |
| | | 55 | | 'RouteOnly' { |
| | 0 | 56 | | Get-KrCommandsByContext -AnyOf Route -Exact -Module $Module -IncludeNonExported:$IncludeNonExported -Functio |
| | | 57 | | } |
| | | 58 | | 'ScheduleOnly' { |
| | 0 | 59 | | Get-KrCommandsByContext -AnyOf Schedule -Exact -Module $Module -IncludeNonExported:$IncludeNonExported -Func |
| | | 60 | | } |
| | | 61 | | 'RouteAndSchedule' { |
| | 0 | 62 | | Get-KrCommandsByContext -AllOf Route, Schedule -Exact -Module $Module -IncludeNonExported:$IncludeNonExporte |
| | | 63 | | } |
| | | 64 | | 'ScheduleAndDefinition' { |
| | 0 | 65 | | Get-KrCommandsByContext -AnyOf ScheduleAndDefinition -Exact -Module $Module -IncludeNonExported:$IncludeNonE |
| | | 66 | | } |
| | | 67 | | 'Runtime' { |
| | 0 | 68 | | Get-KrCommandsByContext -AnyOf Runtime -Exact -Module $Module -IncludeNonExported:$IncludeNonExported -Funct |
| | | 69 | | } |
| | | 70 | | 'Everywhere' { |
| | 0 | 71 | | Get-KrCommandsByContext -AnyOf Everywhere -Exact -Module $Module -IncludeNonExported:$IncludeNonExported -Fu |
| | | 72 | | } |
| | | 73 | | 'ConfigOnly' { |
| | | 74 | | # Definition but NOT Route or Schedule |
| | 0 | 75 | | Get-KrCommandsByContext -AnyOf Definition -Exact -Module $Module -IncludeNonExported:$IncludeNonExported -Fu |
| | | 76 | | } |
| | | 77 | | } |
| | | 78 | | } |
| | | 79 | | |