< Summary - Kestrun — Combined Coverage

Information
Class: Public.Tasks.Set-KrTaskName
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Tasks/Set-KrTaskName.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 57
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/15/2025 - 01:01:18 Line coverage: 0% (0/7) Total lines: 57 Tag: Kestrun/Kestrun@7c4ce528870211ad6c2d2398c31ec13097fc5840

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Tasks/Set-KrTaskName.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Sets the name and/or description of a task.
 4.DESCRIPTION
 5    This function sets the human-friendly name and/or description of a task identified by its id.
 6.PARAMETER Server
 7    The Kestrun server instance.
 8.PARAMETER Id
 9    The id of the task to update. This parameter is mandatory.
 10.PARAMETER Name
 11    The new name for the task. This parameter is optional but at least one of Name or Description must be provided.
 12.PARAMETER Description
 13    The new description for the task. This parameter is optional but at least one of Name or Description must be provide
 14.EXAMPLE
 15    Set-KrTaskName -Id 'task-id' -Name 'My Task'
 16    This command sets the name of the specified task to 'My Task'.
 17.EXAMPLE
 18    Set-KrTaskName -Id 'task-id' -Description 'This is a sample task.'
 19    This command sets the description of the specified task.
 20.EXAMPLE
 21    Set-KrTaskName -Id 'task-id' -Name 'My Task' -Description 'This is a sample task.'
 22    This command sets both the name and description of the specified task.
 23.NOTES
 24    At least one of the Name or Description parameters must be provided and non-empty.
 25    If the specified task id does not exist, an error will be thrown.
 26#>
 27function Set-KrTaskName {
 28    [KestrunRuntimeApi('Everywhere')]
 29    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
 30    param(
 31        [Parameter(ValueFromPipeline = $true)]
 32        [Kestrun.Hosting.KestrunHost]$Server,
 33
 34        [Parameter(mandatory = $true)]
 35        [string]$Id,
 36
 37        [Parameter(Mandatory = $false)]
 38        [string]$Name,
 39
 40        [parameter(Mandatory = $false)]
 41        [string]$Description
 42    )
 43    begin {
 044        $Server = Resolve-KestrunServer -Server $Server
 45    }
 46    process {
 047        if ([string]::IsNullOrWhiteSpace($Name) -and [string]::IsNullOrWhiteSpace($Description)) {
 048            throw [System.ArgumentException] 'Either Name or Description must be provided and non-empty.'
 49        }
 050        if ($PSBoundParameters.ContainsKey('Name')) {
 051            $Server.Tasks.SetTaskName($Id, $Name)
 52        }
 053        if ($PSBoundParameters.ContainsKey('Description')) {
 054            $Server.Tasks.SetTaskDescription($Id, $Description)
 55        }
 56    }
 57}

Methods/Properties

Set-KrTaskName()